const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [a, b, c] = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(a, b, c)
    }
    console.log(output.join('\n'))
// })()
})

function solve(a, b, c) {
    const oa = a & 1
    const ob = b & 1
    const oc = c & 1
    if (oa) {
        if (ob) {
            if (oc) {
                return 0
            } else {
                return 1
            }
        } else {
            if (oc) {
                return b ? 0 : 1
            } else {
                return 1
            }
        }
    } else {
        if (ob) {
            if (oc) {
                return 1
            } else {
                return 0
            }
        } else {
            if (oc) {
                return 1
            } else {
                return 0
            }
        }
    }
    // if (true) {}
    // const sum = a + 2 * b + 3 * c
    // const half = Math.floor(sum / 2)
    // const k = Math.floor(half / 3)
    // const r = half % 3
    // if (sum & 1) {
    //     if (k <= c) {
    //         switch (r) {
    //         case 2: return (b || a >= 2) ? 0 : (a ? 1 : 2)
    //         case 1: return (b || a >= 2) ? 0 : 1
    //         default:
    //         case 0: return 1
    //         }
    //     } else {
    //         const d = half - 3 * c
    //         if (d & 1) {
    //             return (b >= d / 2 && a) || (a >= d) ? 0 : 1
    //         } else {
    //             return (b >= d / 2 || a >= d) ? 0 : 1
    //         }
    //     }
    // } else {
    //     if (k <= c) {
    //         switch (r) {
    //         case 2: return (b || a >= 2) ? 0 : (a ? 1 : 2)
    //         case 1: return a ? 0 : 1
    //         default:
    //         case 0: return 0
    //         }
    //     } else {
    //         const d = half - 3 * c
    //         if (d & 1) {
    //             return (b >= d / 2 && a) || (a >= d) ? 0 : 1
    //         } else {
    //             return (b >= d / 2 || a >= d) ? 0 : 1
    //         }
    //     }
    // }
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var a = nextInt() % 2;
		var b = nextInt() % 2;
		var c = nextInt() % 2;
		if(a == 0){
			a += 2;
		}
		if(b == 0){
			b += 2;
		}
		if(c == 0){
			c += 2;
		}
		var check = [a,b,c];
		var N = check.length;
		var isOK = false;
		for(var i = 0; i < (1 << N); i++){
			var L = [];
			var R = [];
			for(var j = 0; j < N; j++){
				if((i & (1 << j)) != 0){
					L.push(j + 1);
				}else{
					R.push(j + 1);
				}
			}
			if(L.length > 0 && R.length > 0){

				var LV = 0;
				for(var j = 0; j < L.length; j++){
					LV += check[L[j] - 1] * L[j];
				}
				var RV = 0;
				for(var j = 0; j < R.length; j++){
					RV += check[R[j] - 1] * R[j];
				}
				if(LV == RV){
					isOK = true;
					break;
				}else{

				}
			}
		}

		if(isOK){
			myout(0);
			continue;
		}
		if(a == 2 && b == 1 && c == 2){
			myout(0);
			continue;
		}
		myout(1);
		//myout((isOK) ? 0 : 1);

	}
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(l = 1; l <= n; l++){
        var k = lines[l].split(' ').map(Number);
        var a = k[0];
        var b = k[1];
        var c = k[2];
        var total = a + (b * 2) + (c * 3);
        if(total % 2 === 0){
            console.log(0);
        }else{
            console.log(1);
        }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var l = 1; l <= n; l++){
        var k = lines[l].split(' ').map(Number);
        var a = k[0];
        var b = k[1];
        var c = k[2];
        var total = a + (b * 2) + (c * 3);
        if(total % 2 === 0){
            console.log(0);
        }else{
            console.log(1);
        }
    }
});

function solve() {
   const [a, b, c] = readArray(BigInt);
   write((a + 2n * b + 3n * c) & 1n);
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e);
   }
}

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

// using ES6 modules import - you need to have the "module" property set to "commonjs" in the package.json
// const { readline, print, console } = require('@ip-algorithmics/codeforces-io');
var n = readline();
for(var k = 0; k < n; k++){
    var result = 0;
    var num = readline().split(" ").map(x => parseInt(x));
    for (var i = 0; i < num.length; i++) {
        result+=(num[i] * (i+1))
    }
    print(result % 2)
}
// var num = readline().split(" ").map(x => parseInt(x));
// var h,l;
// h=num[0],l=num[1];

// var r= (l*l-h*h)/(2*h);
// print(r);

// var num = readline().split(" ").map(x => parseInt(x));
// var h,l;
// h=num[0],l=num[1];

// var r= (l*l-h*h)/(2*h);
// print(r);

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var a = nextInt() % 2;
		var b = nextInt() % 2;
		var c = nextInt() % 2;
		if(a == 0){
			a += 2;
		}
		if(b == 0){
			b += 2;
		}
		if(b == 0){
			b += 2;
		}
		var check = [a,b,c];
		var N = check.length;
		var isOK = false;
		for(var i = 0; i < (1 << N); i++){
			var L = [];
			var R = [];
			for(var j = 0; j < N; j++){
				if((i & (1 << j)) != 0){
					L.push(j + 1);
				}else{
					R.push(j + 1);
				}
			}
			if(L.length > 0 && R.length > 0){
				var LV = 0;
				for(var j = 0; j < L.length; j++){
					LV += check[L[j] - 1] * L[j];
				}
				var RV = 0;
				for(var j = 0; j < R.length; j++){
					RV += check[R[j] - 1] * R[j];
				}
				if(LV == RV){
					isOK = true;
					break;
				}
			}
		}
		myout((isOK) ? 0 : 1);

	}
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var a = nextInt() % 2;
		var b = nextInt() % 2;
		var c = nextInt() % 2;
		var check = [a,b,c];
		var N = check.length;
		var isOK = false;
		for(var i = 0; i < (1 << N); i++){
			var L = [];
			var R = [];
			for(var j = 0; j < N; j++){
				if((i & (1 << j)) != 0){
					L.push(j + 1);
				}else{
					R.push(j + 1);
				}
			}
			if(L.length > 0 && R.length > 0){
				var LV = 0;
				for(var j = 0; j < L.length; j++){
					LV += check[L[j] - 1] * L[j];
				}
				var RV = 0;
				for(var j = 0; j < R.length; j++){
					RV += check[R[j] - 1] * R[j];
				}
				if(LV == RV){
					isOK = true;
					break;
				}
			}
		}
		myout((isOK) ? 0 : 1);

	}
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var a = nextInt();
		var b = nextInt();
		var c = nextInt();
		var check = [a,b,c];
		var N = check.length;
		var isOK = false;
		for(var i = 0; i < (1 << N); i++){
			var L = [];
			var R = [];
			for(var j = 0; j < N; j++){
				if((i & (1 << j)) != 0){
					L.push(j + 1);
				}else{
					R.push(j + 1);
				}
			}
			if(L.length > 0 && R.length > 0){
				var LV = 0;
				for(var j = 0; j < L.length; j++){
					LV += check[L[j] - 1] * L[j];
				}
				var RV = 0;
				for(var j = 0; j < R.length; j++){
					RV += check[R[j] - 1] * R[j];
				}
				if(LV == RV){
					isOK = true;
					break;
				}
			}
		}
		if(isOK){
			myout(0);
			continue;
		}

		var diff = (c % 2 == 1) ? 3 : 0;
		if(diff > 0 && b > 0){
			diff -= 2;
			b--;
		}
		if(diff > 0 && a > 0){
			diff--;
			a--;
		}
		if(b % 2 == 1){
			diff = 2;
			if(a > 0){
				var tmp = Math.min(a, 2);
				diff -= tmp;
				a -= tmp;
			}
		}
		if(a % 2 == 1){
			diff++;
		}
		myout(diff);
	}
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var a = nextInt();
		var b = nextInt();
		var c = nextInt();
		if(a + b * 2 == c * 3){
			myout(0);
			continue;
		}
		if(a + c * 3 == b * 2){
			myout(0);
			continue;
		}
		var diff = (c % 2 == 1) ? 3 : 0;
		if(diff > 0 && b > 0){
			diff -= 2;
			b--;
		}
		if(diff > 0 && a > 0){
			diff--;
			a--;
		}
		if(b % 2 == 1){
			diff = 2;
			if(a > 0){
				var tmp = Math.min(a, 2);
				diff -= tmp;
				a -= tmp;
			}
		}
		if(a % 2 == 1){
			diff++;
		}
		myout(diff);
	}
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var a = nextInt();
		var b = nextInt();
		var c = nextInt();
		var diff = (c % 2 == 1) ? 3 : 0;
		if(diff > 0 && b > 0){
			diff -= 2;
			b--;
		}
		if(diff > 0 && a > 0){
			diff--;
			a--;
		}
		if(b % 2 == 1){
			diff = 2;
			if(a > 0){
				var tmp = Math.min(a, 2);
				diff -= tmp;
				a -= tmp;
			}
		}
		if(a % 2 == 1){
			diff++;
		}
		myout(diff);
	}
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var l = 1; l <= n; l++){
        var k = lines[l].split(' ').map(Number);
        var a = k[0];
        var b = k[1];
        var c = k[2];
        var total = a + b + c;
        if(total % 2 === 1){
            console.log(0);
        }else{
            console.log(1);
        }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var l = 1; l <= n; l++){
        var k = lines[l].split(' ').map(Number);
        var a = k[0];
        var b = k[1];
        var c = k[2];
        var total = a + b + c;
        if(total % 2 === 0){
            console.log(0);
        }else{
            console.log(1);
        }
    }
});

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [a, b, c] = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(a, b, c)
    }
    console.log(output.join('\n'))
// })()
})

function solve(a, b, c) {
    const oa = a & 1
    const ob = b & 1
    const oc = c & 1
    if (oa) {
        if (ob) {
            if (oc) {
                return 0
            } else {
                return 1
            }
        } else {
            if (oc) {
                return b ? 0 : 1
            } else {
                return 1
            }
        }
    } else {
        if (ob) {
            if (oc) {
                return 1
            } else {
                return 0
            }
        } else {
            if (oc) {
                return 3
            } else {
                return 0
            }
        }
    }
    // if (true) {}
    // const sum = a + 2 * b + 3 * c
    // const half = Math.floor(sum / 2)
    // const k = Math.floor(half / 3)
    // const r = half % 3
    // if (sum & 1) {
    //     if (k <= c) {
    //         switch (r) {
    //         case 2: return (b || a >= 2) ? 0 : (a ? 1 : 2)
    //         case 1: return (b || a >= 2) ? 0 : 1
    //         default:
    //         case 0: return 1
    //         }
    //     } else {
    //         const d = half - 3 * c
    //         if (d & 1) {
    //             return (b >= d / 2 && a) || (a >= d) ? 0 : 1
    //         } else {
    //             return (b >= d / 2 || a >= d) ? 0 : 1
    //         }
    //     }
    // } else {
    //     if (k <= c) {
    //         switch (r) {
    //         case 2: return (b || a >= 2) ? 0 : (a ? 1 : 2)
    //         case 1: return a ? 0 : 1
    //         default:
    //         case 0: return 0
    //         }
    //     } else {
    //         const d = half - 3 * c
    //         if (d & 1) {
    //             return (b >= d / 2 && a) || (a >= d) ? 0 : 1
    //         } else {
    //             return (b >= d / 2 || a >= d) ? 0 : 1
    //         }
    //     }
    // }
}


const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin
});

let tests = [];
rl.on('line', (line) => {
  tests.push(line);
}).on('close', () => {
  for (ii = 1; ii < tests.length; ii += 3) {
    let countStap = 0;
    const candy = tests[ii + 1].split(' ').map(x => +x);
    const orange = tests[ii + 2].split(' ').map(x => +x);
    const minCandy = Math.min(...candy);
    const minOrange = Math.min(...orange);

    for (i = 0; i < candy.length; i++) {
      if (candy[i] > minCandy && orange[i] > minOrange) {
        const minStap = Math.min(candy[i] - minCandy, orange[i] - minOrange);

        countStap += minStap + (candy[i] - minCandy - minStap) + (orange[i] - minOrange - minStap);
      } else if (candy[i] > minCandy && orange[i] == minOrange) {
        countStap += candy[i] - minCandy
      } else if (orange[i] > minOrange && candy[i] == minCandy) {
        countStap += orange[i] - minOrange
      }
    }
    process.stdout.write(`${countStap}\n`);
  }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
//
// rl.question("", function (n) {
//   functions();
// })
//
// function functions() {
//   rl.question("", function (num) {
//     rl.question("", function (name) {
//       var bool = true;
//       var sN = name.split(" ");
//       var na = sN.sort();
//       for (var i = 0; i < na.length; i++) {
//         if (na[i + 1] - na[i] > 1) {
//           var bool = false;
//         }
//       }
//       if (bool) {
//         console.log('YES')
//       } else {
//         console.log('NO')
//       }
//       functions();
//     });
//   })
// }
rl.question('', function () {
  functions();
})
function functions() {
  rl.question('', function (n) {
    rl.question('', function (a) {
      rl.question('', function (b) {
        var s = 0;
        var sa = a.split(' ');
        var sb = b.split(' ');
        // console.log(n, newA, s, sa, sb)
        for (var i = 0; i < n; i++) {
          var newA = [];
          var ai = sa[i] - Math.min.apply(Math, sa)
          var bi = sb[i] - Math.min.apply(Math, sb)
          newA.push(ai);
          newA.push(bi);
          s += Math.max.apply(Math, newA);
          // console.log()
        }
        console.log(s)
        functions();
      })
    })
  })
}

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    let len = +readLine();
    const candy = readLine()
      .split(" ")
      .map((n) => parseInt(n));
    const orange = readLine()
      .split(" ")
      .map((n) => parseInt(n));
    let count = 0;
    const [min1, min2] = [Math.min(...candy), Math.min(...orange)];
    for (let i = 0; i < len; i++) {
      const [a, b] = [candy[i], orange[i]];
      const [move1, move2] = [a - min1, b - min2];
      count += Math.max(move1, move2);
    }

    console.log(count);
  }
}

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});

let input = [];

rl.on('line', function (line) {
    input.push(line);
});

rl.on('close', function () {
    const total = Number(input[0]);
    for (let ii = 0; ii < 3 * total; ii += 3) {
        let arr1 = input[ii + 2].split(' ').map(x => Number(x));
        let arr2 = input[ii + 3].split(' ').map(x => Number(x));
        let ans = 0;
        let min1 = arr1[0];
        let min2 = arr2[0];
        for(let i =1; i<arr1.length; i++) {
            if (min1 > arr1[i]) {
                min1 = arr1[i];
            }
            if (min2 > arr2[i]) {
                min2 = arr2[i];
            }
        }

        for (let i = 0; i < arr1.length; i++) {
            ans += Math.max(arr1[i] - min1, arr2[i] - min2);
        }
        console.log(ans)
    }
});

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var n = nextInt();
    var alist = nextIntArray();
    var blist = nextIntArray();
    var amin = Math.min.apply(null, alist);
    var bmin = Math.min.apply(null, blist);
    var aminlist = new Array(n).fill(0);
    var bminlist = new Array(n).fill(0);
    var count = 0;
    for(var j = 0; j < n; j++){
      if(alist[j] > amin){
        aminlist[j] = alist[j] - amin;
      }
      if(blist[j] > bmin){
        bminlist[j] = blist[j] - bmin;
      }
    }
    for(var j = 0; j < n; j++){
      if(aminlist[j] > 0 && bminlist[j] > 0){
        var common = Math.min(aminlist[j], bminlist[j]);
        count += aminlist[j] + bminlist[j] - common;
      }else{
        count += aminlist[j] + bminlist[j];
      }
    }
    output[i] = count;
  }
  myout(myconv(output, 9));
}

let inputString = '';
let currentLine = 0;

const runMain = () => {
  inputString = inputString.trim().split('\n').map(string => string.trim());
  main();
  process.exit();
}
const readLine = () => inputString[currentLine++];

process.stdin.on('data', inputStdin => inputString += inputStdin);
process.stdin.on('end', runMain);
process.on('SIGINT', runMain);

function main() {
  let t = readLine();
  while (t--) {
    const n = readLine();
    const a = readLine().split(' ').map(num => Number(num));
    const b = readLine().split(' ').map(num => Number(num));
    const aMin = Math.min(...a);
    const bMin = Math.min(...b);
    let res = 0;
    for (let i = 0; i < n; i++) {
      res += Math.max(a[i] - aMin, b[i] - bMin);
    }
    console.log(res);
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
});

process.stdin.on('end', () => {
  main(stdinInput);
});

function main(data) {
	data = data.split('\n');
	const testCases = data[0] * 3;
    let i = 1;
    outer:
	while (i <= testCases) {
	  let n = data[i] * 1;
	  let a = data[i + 1].trim().split(' ').map(Number);
	  let b = data[i + 2].trim().split(' ').map(Number);
	  let count = 0;
	  let minA = Math.min(...a);
	  let minB = Math.min(...b);
	  for (let j = 0; j < n; j += 1) {
	    let diffA = a[j] - minA;
      let diffB = b[j] - minB;
      if (a[j] > minA && b[j] > minB) {
        let min = Math.min(diffA, diffB);
        if (min === diffA) {
          count += diffA;
          count += (diffB - diffA);
        } else {
          count += diffB;
          count += (diffA - diffB);
        }
      } else if (a[j] > minA) count += diffA;
      else count += diffB;
	  }
	  console.log(count);
    i += 3;
	}
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

function print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // input
  let t = +readline();
  for (let i = 0; i < t; i++) {
    const n = +readline();
    const a = readline().split(' ').map(x => parseInt(x));
    const b = readline().split(' ').map(x => parseInt(x));
    const minA = Math.min(...a);
    const minB = Math.min(...b);
    let m = 0;
    for (let i = 0; i < n; i++) {
      m += Math.max(Math.abs(a[i] - minA), Math.abs(b[i] - minB));
    }
    print(`${m}\n`);
  }
}

const processData = (lines) => {
    let acc = 0
    const n = +lines[acc++]
    for (let i=0; i<n; i++) {
        const count =  +lines[acc++]
        const a = lines[acc++].split(' ').map(x => +x)
        const b = lines[acc++].split(' ').map(x => +x)

        const leastA = Math.min(...a)
        const leastB = Math.min(...b)

        let sum = 0

        for (let i=0; i< count; i++) {
            const diffA = a[i] - leastA
            const diffB = b[i] - leastB
            sum += Math.max(diffA, diffB)
        }

        console.log(sum)
    }

}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    processData(lines)
})

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = ''
let currentLine = 0

process.stdin.on('data', inputStdin => {
    inputString += inputStdin
})

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n')

    main()
})

function readLine() {
    return inputString[currentLine++]
}

const s2i = s => parseInt(s, 10)

const readLineOfBigInts = () => {
  const split = readLine().split(' ')
  const result = []
  for (let i = 0, l = split.length; i < l; i++) {
    result.push(BigInt(split[i]));
  }
  return result
}

const cmpi = (a, b) => a - b

function main() {
  let T = s2i(readLine())
  let out = ''

  while (T--) {
    const n = s2i(readLine())
    const a = readLine().split(' ').map(s2i)
    const b = readLine().split(' ').map(s2i)

    let minA = a[0]
    let minB = b[0]

    for (let i = 1; i < n; i++) {
      if (a[i] < minA) minA = a[i]
      if (b[i] < minB) minB = b[i]
    }

    let moves = 0

    for (let i = 0; i < n; i++) {
      moves += Math.max(a[i] - minA, b[i] - minB)
    }

    out += moves + '\n'
  }

  console.log(out)
}

let inputString = '';
let currentLine = 0;
process.stdin.on('data', data => {
	inputString += data;
});
process.stdin.on('end', function () {
	inputString = inputString
		.trim()
		.split('\n')
		.map(str => str.trim());
	main();
});

function readLine() {
	return inputString[currentLine++];
}

function main() {
	let t = readLine() >> 0;
	while (t--) {
		let n = readLine() >> 0;
		let candy = readLine()
			.split(' ')
			.map(x => x >> 0);
		let orange = readLine()
			.split(' ')
			.map(x => x >> 0);

		let minC = Math.min(...candy);
		let minO = Math.min(...orange);

		let count = 0;

		for (let i = 0; i < n; i++) {
			let gc = candy[i];
			let go = orange[i];

			let x = Math.min(gc - minC, go - minO);

			if (gc > minC && go > minO) {
				count += x;
				gc -= x;
				go -= x;
			}

			if (gc > minC) {
				count += gc - minC;
			}

			if (go > minO) {
				count += go - minO;
			}
		}

		console.log(count);
	}
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main(){
    let t = parseInt(readline());
    for(let k = 0; k < t; k++){
        let n = parseInt(readline());
        let a = readline().split(' ');
        let b = readline().split(' ');

        let minA = 999999999999999;
        let minB = 999999999999999;

        for(let i = 0; i < n; i++){
            minA = Math.min(minA, a[i]);
            minB = Math.min(minB, b[i]);
        }

        for(let i = 0; i < n; i++){
            a[i] = a[i]-minA;
            b[i] = b[i]-minB;
        }

        let res = 0;
        for(let i = 0; i < n; i++)
            if(a[i] !== 0 || b[i] !== 0)
                res += Math.max(a[i],b[i]);

        console.log(res);
    }
}

function solve() {
    var n = readInt()
    var aArr = readIntArray()
    var bArr = readIntArray()

    var aMin = Number.MAX_VALUE
    var bMin = Number.MAX_VALUE
    for(var i=0;i<n;i++) {
        if (aArr[i] < aMin) {
            aMin = aArr[i]
        }
        if (bArr[i] < bMin) {
            bMin = bArr[i]
        }
    }

    var answer = 0
    for(var j=0; j<n;j++) {
        var x = aArr[j] - aMin
        var y = bArr[j] - bMin
        answer += Math.max(x,y)
    }
    print(answer)
}

var testCases = readInt();
var testCaseNum;
for(testCaseNum=0; testCaseNum<testCases; testCaseNum++) {
  solve()
}

function readIntArray() {
    return readline().split(" ").map(function(x) { return parseInt(x); });
}

function readInt() {
    return parseInt(readline())
}

function sortIntArr(arr) {
  return arr.sort((a, b) => a - b)
}

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});

let input = [];

rl.on('line', function (line) {
    input.push(line);
});

rl.on('close', function () {
    const total = Number(input[0]);
    for (let ii = 0; ii < 2 * total; ii += 3) {
        let arr1 = input[ii + 2].split(' ').map(x => Number(x));
        let arr2 = input[ii + 3].split(' ').map(x => Number(x));
        let ans = 0;
        let min1 = arr1[0];
        let min2 = arr2[0];
        for(let i =1; i<arr1.length; i++) {
            if (min1 > arr1[i]) {
                min1 = arr1[i];
            }
            if (min2 > arr2[i]) {
                min2 = arr2[i];
            }
        }

        for (let i = 0; i < arr1.length; i++) {
            ans += Math.max(arr1[i] - min1, arr2[i] - min2);
        }
        console.log(ans)
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main(){
    let t = parseInt(readline());
    for(let k = 0; k < t; k++){
        let n = parseInt(readline());
        let a = readline().split(' ');
        let b = readline().split(' ');

        let minA = 99999999;
        let minB = 99999999;

        for(let i = 0; i < n; i++){
            minA = Math.min(minA, a[i]);
            minB = Math.min(minB, b[i]);
        }

        for(let i = 0; i < n; i++){
            a[i] = a[i]-minA;
            b[i] = b[i]-minB;
        }

        let res = 0;
        for(let i = 0; i < n; i++)
            if(a[i] !== 0 || b[i] !== 0)
                res += Math.max(a[i],b[i]);

        console.log(res);
    }
}


 var p,
  row,
  vowels,
  fit,
  i;

readline();
fit = "YES";
vowels = /[aeiouy]/gi;
i = 0;
p = readline().split( " " ).map( pi => parseInt( pi, 10 ) );
while ( row = readline() ) {
  if ( ( row.match( vowels ) || [] ).length !== p[ i++ ] ) {
    fit = "NO";
    break;
  }
}

print( fit );

var vowels = ['a', 'e', 'i', 'o', 'u', 'y'];

function canDiv (word, num) {
  var char = word.split('');

  for (var i = 0; i < char.length; i++) {
    if (vowels.indexOf(char[i]) >= 0) {
      num--;
    }
  }
  return num === 0;
}

function main (num, numList, strList) {
  for (var i = 0; i < num; i++) {
    if (!canDiv(strList[i], numList[i])) {
      print('NO');
      return;
    }
  }
  print('YES');
}

var num = parseInt(readline()),
    numList = readline().split(' ').map(function (x) {
      return parseInt(x);
    }),
    strList = [];

for (var  i = 0; i < num; i++) {
  strList.push(readline());
}
main(num, numList, strList);

var vowels = ['a', 'e', 'i', 'o', 'u', 'y'];

function canDiv (word, num) {
  var char = word.split('');

  var hasVowel = char.map(function (x) {
    return vowels.indexOf(x);
  }).filter(function (x) {
    return x >= 0;
  });
  //if (hasVowel.length === 0) return false;

  for (var i = 0; i < char.length; i++) {
    if (vowels.indexOf(char[i]) >= 0) {
      num--;
    }
  }
  return num === 0;
}

function main (num, numList, strList) {
  for (var i = 0; i < num; i++) {
    if (!canDiv(strList[i], numList[i])) {
      print('NO');
      return;
    }
  }
  print('YES');
}

// var num = parseInt('3'),
//     numList = '2 2 3'.split(' '),
//     strList = 'intel\ncode\nch allenge'.split('\n');
// debugger;
// main(num, numList, strList);

var num = parseInt(readline()),
    numList = readline().split(' '),
    strList = [];
for (var  i = 0; i < num; i++) {
  strList.push(readline());
}
main(num, numList, strList);

var vowels = ['a', 'e', 'i', 'o', 'u', 'y'];

function canDiv (word, num) {
  var char = word.split('');

  var hasVowel = char.map(function (x) {
    return vowels.indexOf(x);
  }).filter(function (x) {
    return x >= 0;
  });
  if (hasVowel.length === 0) return false;

  for (var i = 0; i < char.length; i++) {
    if (vowels.indexOf(char[i]) >= 0) {
      num--;
    }
  }
  return num === 0;
}

function main (num, numList, strList) {
  for (var i = 0; i < num; i++) {
    if (!canDiv(strList[i], numList[i])) {
      print('NO');
      return;
    }
  }
  print('YES');
}

// var num = parseInt('3'),
//     numList = '2 2 3'.split(' '),
//     strList = 'intel\ncode\nch allenge'.split('\n');
// debugger;
// main(num, numList, strList);

var num = parseInt(readline()),
    numList = readline().split(' '),
    strList = [];
for (var  i = 0; i < num; i++) {
  strList.push(readline());
}
main(num, numList, strList);

var vowels = ['a', 'e', 'i', 'o', 'u', 'y'];

function canDiv (word, num) {
  for (var i = 0; i < word.length; i++) {
    if (vowels.indexOf(word[i]) >= 0) {
      num--;
    }
  }
  return num === 0;
}

function main (num, numList, strList) {
  // for (var i = 0; i < num; i++) {
  //   if (!canDiv(strList[i], numList[i])) {
  //     print('NO');
  //     return;
  //   }
  // }
  // print('YES');

  for (var i = 0; i < num; i++)
  {
    for (var j = 0; j < strList[i].length; j++)
      if (vowels.indexOf(strList[i][j]) >= 0)
        numList[i]--;
    if (numList[i] !== 0)
    {
      print('NO');
      return;
    }
  }
  print('YES');
}

var num = parseInt(readline()),
    numList = readline().split(' '),
    strList = [];

for (var  i = 0; i < num; i++) {
  strList.push(readline());
}
main(num, numList, strList);

var vowels = ['a', 'e', 'i', 'o', 'u', 'y'];

function canDiv (word, num) {
  for (var i = 0; i < word.length; i++) {
    if (vowels.indexOf(word[i]) >= 0) {
      num--;
    }
  }
  return num === 0;
}

function main (num, numList, strList) {
  for (var i = 0; i < num; i++) {
    if (!canDiv(strList[i], numList[i])) {
      print('NO');
      return;
    }
  }
  print('YES');
}

// var num = parseInt('3'),
//     numList = '2 2 3'.split(' '),
//     strList = 'intel\ncode\nch allenge'.split('\n');
// debugger;
// main(num, numList, strList);

var num = parseInt(readline()),
    numList = readline().split(' '),
    strList = [];

for (var  i = 0; i < num; i++) {
  strList.push(readline());
}
main(num, numList, strList);


'use strict'

const ord = x => x.charCodeAt(0) - 97;

// G - G[i] хранит объект первых индексов каждого символа в строке s, начиная поиск с индекса i
// D - динамика, D[i][j] хранит минимальную длину x префикса строки s, в котором содержится a[:i] и b[:j]
// D[0][0] = 0 - то есть для пустых префиксов - минимальным будет пустой префикс s
const interleaving = (a, b, G) => {
    const D = Array.from({ length: a.length + 1 }, () => Array(b.length + 1).fill(Infinity)); D[0][0] = 0;
    for (let i = 0; i < a.length + 1; i++) {
        for (let j = 0; j < b.length + 1; j++) {
            if (!isFinite(D[i][j])) continue;
            const x = D[i][j];
            if (i !== a.length) D[i+1][j] = Math.min(D[i+1][j], G[x][ord(a[i])] + 1);
            if (j !== b.length) D[i][j+1] = Math.min(D[i][j+1], G[x][ord(b[j])] + 1);
        }
    }

    return isFinite(D[a.length][b.length]);
}

const problem = (s, p) => {
    const n = s.length;
    const G = Array.from({ length: n + 2}, () => Array(26).fill(Infinity));
    for (let i = n - 1; i > -1; i--) { G[i] = G[i + 1].slice(); G[i][ord(s[i])] = i; }
    for (let i = 0; i < p.length; i++) if (interleaving(p.slice(0, i), p.slice(i), G, n)) return 'YES';
    return 'NO';
}

let t = +readline()
while(t--) print(problem(readline(), readline()));

'use strict'
const ord = x => x.charCodeAt(0) - 97;

const problem = (s, p) => {
    const n = s.length;
    const F = [];
    for (let i = 0; i < n + 2; i++) F[i] = Array(26).fill(n);
    for (let i = n-1; i > -1; i--) {
        F[i] = F[i + 1].slice()
        F[i][ord(s[i])] = i
    }
    const interleaving = (l, r) => {
        const dp = Array(r.length + 1).fill(n); dp[0] = -1;

        for (let j = 1; j < r.length + 1; j++) {
            dp[j] = F[dp[j - 1] + 1][ord(r[j - 1])]
        }

        for (let i = 1; i < l.length + 1; i++) {
            dp[0] = F[dp[0] + 1][ord(l[i - 1])]

            for (let j = 1; j < r.length + 1; j++) {
                const a = F[dp[j] + 1][ord(l[i - 1])]
                const b = F[dp[j - 1] + 1][ord(r[j - 1])]
                dp[j] = Math.min(a, b)
            }
        }
        return dp[dp.length - 1] < n
    }

    for (let i = 0; i < p.length; i++) if (interleaving(p.slice(0, i), p.slice(i))) return 'YES'
    return 'NO'
}

let t = +readline()
while(t--) print(problem(readline().split(''), readline()));

'use strict'

const problem = (s, p) => {
    let j = 0;
    for (let i = 0; i < s.length; i++) {
        if (s[i] === p[j]) j++;
        if (j === p.length) return 'YES';
    }
    for (let i = 0; i < s.length; i++) {
        if (s[i] === p[j]) j++;
        if (j === p.length) return 'YES';
    }
    return 'NO';
}

let t = +readline()
while(t--) print(problem(readline(), readline()));

'use strict'

const problem = (s, p) => {
    let j = 0;
    let t = '';
    const pLen = p.length;
    for (let i = 0; i < s.length; i++) {
        if (s[i] === p[j]) { if (++j === pLen) return 'YES'; }
        else t += s[i];
    }
    for (let i = 0; i < t.length; i++) {
        if (t[i] === p[j])  { if (++j === pLen) return 'YES'; }
    }
    return 'NO';
}
let t = +readline()
while(t--) print(problem(readline(), readline()));

'use strict'

// G - G[i] хранит объект первых индексов каждого символа в строке s, начиная поиск с индекса i
// D - динамика, D[i][j] хранит минимальную длину x префикса строки s, в котором содержится a[:i] и b[:j]
// D[0][0] = 0 - то есть для пустых префиксов - минимальным будет пустой префикс s
const interleaving = (a, b, G) => {
    const D = Array.from({ length: a.length + 1 }, () => Array(b.length + 1).fill(Infinity)); D[0][0] = 0;
    for (let i = 0; i < a.length + 1; i++) {
        for (let j = 0; j < b.length + 1; j++) {
            if (!isFinite(D[i][j])) continue;
            const x = D[i][j];
            if (i !== a.length && a[i] in G[x]) D[i+1][j] = Math.min(D[i+1][j], G[x][a[i]] + 1);
            if (j !== b.length && b[j] in G[x]) D[i][j+1] = Math.min(D[i][j+1], G[x][b[j]] + 1);
        }
    }
    return isFinite(D[a.length][b.length]);
}
const problem = (s, p) => {
    if (s === 'adddbefbbbeeaadcddabfffcbeaecfadbdbfecebabbefbedfbdcafbfcbfacecbdcfaabeacdacfebabaccaddbebdabdeebcafcaabadabeaeeebeddffbabfaeedcbefbdcbfacaeefeafccadadadcdabcbdaadcdbbacadfabfbdaaeceaabbdabfabeacddacecdcabfeeaedebffefcecabcabecffcebdefcfaeadbfddbdfefeacdfcdebbdcbaafcfbbfceadfdabfcdacefdeadadbfedbaaefbcccfcdcdbfbbacfbfcbcabcbcbbffbbcefbeccdcaebabbbbdddaffacabbabbbadfcaadbedbaabbaffebdfbdbbcbfffeafe')
        print(p)
    const G = Array.from({ length: s.length + 1 }, () => ({}));
    for (let i = s.length - 1; i > -1; i--) G[i] = Object.assign({}, G[i + 1], { [s[i]]: i });
    for (let i = 0; i < p.length; i++) if (interleaving(p.slice(0, i), p.slice(i), G)) return 'YES';
    return 'NO';
}

let t = +readline()
while(t--) print(problem(readline(), readline()));


'use strict';

const { createInterface } = require('readline');
const rl = createInterface({
  input: process.stdin,
  crlfDelay: Infinity
});

const lines = [];
let nextLine = 0;
rl.on('line', (line) => {
  lines.push(line);
});

rl.on('close', () => {
  main();
});

function readline() {
  return lines[nextLine++];
}

function solve(arr) {
  const n = arr.length;
  if (n < 2) {
    return arr;
  }
  const bitIdx = {};
  for (let i = 0; i < n; i++) {
    const a = arr[i];
    for(let b = 1; b <= a; b <<= 1) {
      if (a & b) {
        if (bitIdx[b] === undefined) {
          bitIdx[b] = i;
        } else {
          bitIdx[b] = -1;
        }
      }
    }
  }
  const order = Object.keys(bitIdx).sort((a,b)=> b - a);
  // console.log({bitIdx, order});
  let idx = 0;
  for (const k of order) {
    if (bitIdx[k] !== -1) {
      idx = bitIdx[k];
      break;
    }
  }
  const head = arr[idx];
  arr.splice(idx,1);
  arr.unshift(head);
  return arr;
}

function main() {
  readline();
  const arr = readline().split(' ').map(Number);
  const res = solve(arr);
  console.log(res.join(' '));
}

'use strict'

const problem = (n, a) => {
    const d = Array(31).fill(0), p = [];
    const b = a.map(i => (+i).toString(2));

    for (let i = 0; i < n; i++) {
        const x = b[i].split('').reverse();
        for (let j = 0; j < x.length; j++) {
            if (x[j] === '1') { d[j]++; p[j] = i; }
        }
    }
    for (let i = d.length - 1; i > -1; i--) {
        if (d[i] === 1) return [ a[p[i]], a.slice(0, p[i]).join(' '), a.slice(p[i]+1).join(' ') ].join(' ');
    }
    return a.join(' ');
}
print(problem(+readline(), readline().split(' ')))

const f = (x, y) => (x | y) - y

const processData = (lines) => {
  const bits = Array(32).fill(0).map(() => [])

  let nums = lines[1].split(' ').map(x => +x)
  for (let k =0; k<nums.length; k++) {
    const n = nums[k]
    const str = n.toString(2).split('').reverse()
    for (let j = 0; j < str.length; j++) {
      if (str[j] === '1') {
        bits[j].push(k)
      }
    }
  }

  let restNum = null
  for (const bitArr of bits) {
    if (bitArr.length === 1) {
      restNum = bitArr[0]
    }
  }
  if (restNum === null) {
    console.log(nums.join(' '))
  } else {
    const removed = nums.splice(restNum, 1)
    console.log([removed[0], ...nums].join(' '))
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

'use strict'

const problem = (n, a) => {
    const d = Array(31).fill(0), p = [];
    const b = a.map(i => (+i).toString(2));
    for (let i = 0; i < n; i++) {
        const x = b[i]
        for (let j = x.length - 1; j > -1; j--) {
            d[j]++;
            p[j] = i;
        }
    }
    for (let i = d.length - 1; i > -1; i--) {
        if (d[i] === 1) return [ a[p[i]], a.slice(0, p[i]).join(' '), a.slice(p[i]+1).join(' ') ].join(' ');
    }
    return a.join(' ');
}
print(problem(+readline(), readline().split(' ')))

'use strict';

const { createInterface } = require('readline');
const rl = createInterface({
  input: process.stdin,
  crlfDelay: Infinity
});

const lines = [];
let nextLine = 0;
rl.on('line', (line) => {
  lines.push(line);
});

rl.on('close', () => {
  main();
});

function readline() {
  return lines[nextLine++];
}

function solve(arr) {
  arr.sort((a, b) => b - a);
  return arr;
}

function main() {
  readline();
  const arr = readline().split(' ').map(Number);
  const res = solve(arr);
  console.log(res.join(' '));
}


function main(n,b,d,arr){

    var fits = 0;
    var res = 0;

    for(var i = 0 ; i < n ; i++){
      if(arr[i] > b)continue;

      fits += arr[i];
      if(fits <= d)continue;

      res++;
      fits = 0;

    }
    print(res);
}

var nbd = readline().split(" ");
var arr = readline().split(" ");
for(var i = 0 ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);

main(parseInt(nbd[0]),parseInt(nbd[1]),parseInt(nbd[2]),arr);

var firstLine = readline().split(' ').map(Number);

var n = firstLine[0];
var b = firstLine[1];
var d = firstLine[2];

var oranges = readline().split(' ').map(Number);

var count = 0;
var currentLoad = 0;

for (var i = 0; i < n; i++) {
  if (oranges[i] <= b) {
    currentLoad += oranges[i];
  }

  if (currentLoad > d) {
    count++;
    currentLoad = 0;
  }
}

print(count);

var params = readline().split(' ').map(Number);
var n = params[0]; var b = params[1]; var d = params[2];
var processed_orange_size = 0;
var do_empty = 0;

readline().split(' ').map(function(x){

    x = parseInt(x);
    if(x <= b)
        processed_orange_size += x;

    if(processed_orange_size > d) {
        do_empty++;
        processed_orange_size = 0;
    }
});

print(do_empty);

var x = readline().split(" ");
var a = readline().split(" ").map(Number);
var c = 0, s = 0;
for (var i = 0; i < x[0]; i++) {
	if (a[i] > x[1]) continue;
	s += a[i];
	if (s > x[2]) {
		c++;
		s = 0;
    }
}
print(c);

var values = readline().split(" ").map(Number);
var b = values[1];
var d = values[2];

var oranges = readline().split(" ").map(Number);

var sum = 0;
var count = 0;
for (var i = 0; i < oranges.length; i++) {
    if (oranges[i] > b) {
        continue;
    }

    sum += oranges[i];

    if (sum > d) {
        count++;
        sum = 0;
    }
}

print(count);

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

function readline() {
  return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {

  const x = readline()
    .split(" ")
    .map((x) => +x);

      const x2 = readline()
    .split(" ")
    .map((x) => +x);

  juicer(x[1],x[2],x2);
}

 function juicer(b, d, oranges) {
  let wasteLand = 0;
  let clearCounts = 0;

  for (const orange of oranges) {
    if (orange <= b) wasteLand += orange;

    if (wasteLand > d) {
      wasteLand = 0;
      clearCounts++;
    }
  }

  console.log(clearCounts);

  return clearCounts;
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

function print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // input
  const [n, b, d] = readline().split(' ').map(x => parseInt(x));
  const a = readline().split(' ').map(x => parseInt(x));
  let k = 0;
  let t = 0;
  for (let i = 0; i < n; i++) {
    if (a[i] > b) {
      continue;
    }
    k += a[i];
    if (k > d) {
      k = 0;
      t++;
    }
  }
 // output
  print(t);
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, b, d;

rl.on('line', (data) => {
  if (c === 0) {
    [n, b, d] = data.split(' ').map(Number);
    c++;
    return;
  }

  const arr = data.split(' ').map(Number).filter(x => x <= b);
  let ans = 0;

  let cup = 0;
  for (let i = 0; i < arr.length; i++) {
    cup += arr[i];

    if (cup > d) {
      cup = 0;
      ans++;
    }
  }

  console.log(ans);

  c++;
});

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function readint() {
    let line = readline().split(' ').map(function(num) {
        return parseInt(num);
    });
    return line;
}

function readfloat() {
    let line = readline().split(' ').map(function(num) {
        return parseFloat(num);
    });
    return line;
}

function print(x) {
    console.log(x);
}

function write(x) {
    process.stdout.write(x);
}
function main() {
    let t = readint();
    let n, b, d;
    [n,b,d] = t;
    let a = readint();
    let ans = 0;
    let garbage = 0;
    for(let i = 0; i < n; i++) {
        if(a[i] <= b) {
            garbage += a[i];
        }
        if(garbage > d) {
            garbage = 0;
            ans++;
        }
    }
    print(ans);
}

const readline = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
let input = [];
readline.on('line', line => {
  input.push(line);
});
process.stdin.on('end', () => {
let firstLine = input[0].split(' ');
firstLine = firstLine.map((b) => parseInt(b));
const n = firstLine[0];
const maxSize = firstLine[1];
const threshold = firstLine[2];
let oranges = input[1].split(' ');
oranges = oranges.map((b) => parseInt(b));

const res = oranges.reduce((acc, cv) => {
  if (cv > maxSize) {
    return acc;
  }
  acc.currentWaste += cv;
  if (acc.currentWaste > threshold) {
    acc.totalCleanups += 1;
    acc.currentWaste = 0;
  }
  return acc;
}, { totalCleanups: 0, currentWaste: 0 });
console.log(res.totalCleanups)

});

  var informations = readline().split(' ').map(Number)
  var oranges = readline().split(' ').map(Number)
  var numberOfOrange = informations[0]
  var sizeMax = informations[1]
  var containerMax = informations[2]

  var totalPressed = 0
  var numberOfTimeCleaned = 0
  for (var i = 0; i < numberOfOrange; i++) {
    if (oranges[i] <= sizeMax) {
      totalPressed += oranges[i]
    }

    if (totalPressed > containerMax) {
      totalPressed = 0
      numberOfTimeCleaned += 1
    }
  }

  print(numberOfTimeCleaned)

function main(n,b,d,arr){

    var fits = 0;

    for(var i = 0 ; i < n ; i++){
      if(arr[i] < b)fits += arr[i];
    }
    fits = Math.floor(fits/d);
    print(fits);
}

var nbd = readline().split(" ");
var arr = readline().split(" ");
for(var i = 0 ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);

main(parseInt(nbd[0]),parseInt(nbd[1]),parseInt(nbd[2]),arr);

function main(n,b,d,arr){

    var fits = 0;

    for(var i = 0 ; i < n ; i++){
      if(arr[i] <= b)fits += arr[i];
    }
    fits = Math.floor(fits/d);
    print(fits);
}

var nbd = readline().split(" ");
var arr = readline().split(" ");
for(var i = 0 ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);

main(parseInt(nbd[0]),parseInt(nbd[1]),parseInt(nbd[2]),arr);

function main(n,b,d,arr){

    var fits = 0;

    for(var i = 0 ; i < n ; i++){
      if(arr[i] <= b)fits += arr[i];
    }
    fits = fits%d;
    print(fits);
}

var nbd = readline().split(" ");
var arr = readline().split(" ");
for(var i = 0 ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);

main(parseInt(nbd[0]),parseInt(nbd[1]),parseInt(nbd[2]),arr);

  var informations = readline().split(' ').map(Number)
  var oranges = readline().split(' ').map(Number)
  var numberOfOrange = informations[0]
  var sizeMax = informations[1]
  var containerMax = informations[2]

  var totalPressed = 0
  var numberOfTimeCleaned = 0
  for (var i = 0; i < numberOfOrange; i++) {
    if (oranges[i] < sizeMax) {
      totalPressed += oranges[i]
    }

    if (totalPressed > containerMax) {
      totalPressed = 0
      numberOfTimeCleaned += 1
    }
  }

  print(numberOfTimeCleaned)

  var informations = readline().split(' ').map(Number)
  var oranges = readline().split(' ').map(Number)
  var numberOfOrange = informations[0]
  var sizeMax = informations[1]
  var containerMax = informations[2]

  var totalPressed = 0
  for (var i = 0; i < numberOfOrange; i++) {
    if (oranges[i] < sizeMax) {
      totalPressed += oranges[i]
    }
  }

  var numberOfTimeCleaned = Math.floor(totalPressed / containerMax)
  print(numberOfTimeCleaned)

var values = readline().split(" ").map(Number);
var b = values[1];
var d = values[2];

var oranges = readline().split(" ").map(Number);

var sum = 0;
for (var i = 0; i < oranges.length; i++) {
    if (oranges[i] > b) {
        continue;
    }

    sum += oranges[i];
}

print(sum === d ? 0: Math.floor(sum/d));

var values = readline().split(" ").map(Number);
var n = values[1];
var d = values[2];

var oranges = readline().split(" ").map(Number)
                .filter(x => x <= n)
                .reduce((acc, n) => {
                    return acc + n;
                }, 0);

print(Math.floor(oranges/d));

var values = readline().split(" ").map(Number);
var n = values[1];
var d = values[2];

var oranges = readline().split(" ").map(Number)
                .filter(x => x <= n)
                .reduce((acc, n) => {
                    return acc + n;
                }, 0);

print(Math.floor(oranges/10));

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, b, d;

rl.on('line', (data) => {
  if (c === 0) {
    [n, b, d] = data.split(' ').map(Number);
    c++;
    return;
  }

  const arr = data.split(' ').map(Number).filter(x => x <= b);
  const sum = arr.reduce((a, b) => a + b, 0);
  let ans = Math.floor(sum / d);

  if (d === 1) {
    ans--;
  }

  console.log(ans);

  c++;
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, b, d;

rl.on('line', (data) => {
  if (c === 0) {
    [n, b, d] = data.split(' ').map(Number);
    c++;
    return;
  }

  const arr = data.split(' ').map(Number).filter(x => x <= b);
  const sum = arr.reduce((a, b) => a + b, 0);
  const ans = Math.floor(sum / d);

  console.log(ans);

  c++;
});

const readline = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
let input = [];
readline.on('line', line => {
  input.push(line);
});
process.stdin.on('end', () => {
let firstLine = input[0].split(' ');
firstLine = firstLine.map((b) => parseInt(b));
const n = firstLine[0];
const maxSize = firstLine[1];
const threshold = firstLine[2];
let oranges = input[1].split(' ');
oranges = oranges.map((b) => parseInt(b));

const res = oranges.reduce((acc, cv) => {
  if (cv > maxSize) {
    return acc;
  }
  acc.currentWaste += cv;
  if (acc.currentWaste > threshold) {
    acc.totalCleanups += 1;
    acc.currentWaste = 0;
  }
  console.log({cv,acc})
  return acc;
}, { totalCleanups: 0, currentWaste: 0 });
console.log(res.totalCleanups)

});

var values = readline().split(" ").map(Number);
var n = values[1];
var d = values[2];

var oranges = readline().split(" ").map(Number)
                .filter(x => x <= n)
                .reduce((acc, n) => {
                    return acc + n;
                }, 0);

print(oranges === d ? 0: Math.floor(oranges/d));


T = readline()

while(T--){
  n = readline()
  x = 0
  y = 0
  minX = 0
  minY = 0

  while(n--){
    str = readline().split(' ').map(el => +el)
    curx = str[0]
    cury = str[1]

    if(curx){
      if(curx>0)
        x = Math.max(curx, x)
      else if(curx<0)
        minX = Math.max(Math.abs(curx), minX)
    }

    else{
      if(cury>0)
      y = Math.max(cury, y)
    else if(cury<0)
      minY = Math.max(Math.abs(cury), minY)
    }
  }

  ans = (x+y+minX+minY) * 2

  print(ans)
}

let buf='';

process.stdin.on('readable',function(){
    let chunk=process.stdin.read();
    if(chunk) buf+=chunk.toString();
})

process.stdin.on('end',function(){
    const {EOL}=require('os');
    let line=buf.split(EOL);
    let t=parseInt(line[0]);
    let cnt=0;
    for(let i=1;i<=t;i++)
    {
        let n=parseInt(line[++cnt]);
        let ans=0;
        let a=0,b=0,c=0,d=0;
        for(let j=1;j<=n;j++)
        {
            let [x,y]=line[++cnt].split(' ').map(x=>{return parseInt(x)});
            if(!x)
            {
                a=Math.max(a,y);
                b=Math.min(b,y);
            }
            if(!y)
            {
                c=Math.max(c,x);
                d=Math.min(d,x);
            }
            // ans+=2*Math.abs(x);
            // ans+=2*Math.abs(y);
        }
        ans+=2*Math.abs(a);
        ans+=2*Math.abs(b);
        ans+=2*Math.abs(c);
        ans+=2*Math.abs(d);
        console.log(ans);
    }
})

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        const n = parseInt(readline(), 10);
        let maxY = 0;
        let minY = 0;
        let maxX = 0;
        let minX = 0;
        for (let i = 0; i < n; i++) {
            const [x, y] = readline().split(' ').map(Number);
            if (x > maxX) maxX = x;
            if (x < minX) minX = x;
            if (y > maxY) maxY = y;
            if (y < minY) minY = y;
        }

        let res = Math.abs(maxY) + Math.abs(minY) + Math.abs(maxX) + Math.abs(minX);
        res *= 2;
        output(res);
    }
}

var T = parseInt(readline());
for (var tt=0; tt<T; tt++) {
    var n = parseInt(readline());
    var minx=0;
    var maxx=0;
    var miny=0;
    var maxy=0;
    for (var i=0; i<n; i++) {
        var coords = readline().split(" ").map(x => parseInt(x));
        minx=Math.min(coords[0], minx);
        maxx=Math.max(coords[0], maxx);
        miny=Math.min(coords[1], miny);
        maxy=Math.max(coords[1], maxy);
    }

    print(minx*-2+maxx*2+miny*-2+maxy*2);
}

var tests = parseInt(readline());
    var n;
    for (var t=0; t < tests; t++) {
        n = parseInt(readline());
        var minX = 0, maxX = 0, minY = 0, maxY = 0;
        for (var i = 0; i < n; i++) {
            var c = readline().split(' ').map(x=>parseInt(x));
            minX = Math.min(minX, c[0]);
            maxX = Math.max(maxX, c[0]);
            minY = Math.min(minY, c[1]);
            maxY = Math.max(maxY, c[1]);
        }
        var dist = (maxX - minX) * 2 + (maxY - minY) * 2;
        print(dist);
    }

let buf='';

process.stdin.on('readable',function(){
    let chunk=process.stdin.read();
    if(chunk) buf+=chunk.toString();
})

process.stdin.on('end',function(){
    const {EOL}=require('os');
    let line=buf.split(EOL);
    let t=parseInt(line[0]);
    let cnt=0;
    for(let i=1;i<=t;i++)
    {
        let n=parseInt(line[++cnt]);
        let ans=0;
        for(let j=1;j<=n;j++)
        {
            let [x,y]=line[++cnt].split(' ').map(x=>{return parseInt(x)});
            ans+=2*Math.abs(x);
            ans+=2*Math.abs(y);
        }
        console.log(ans);
    }
})

T = readline()

while(T--){
  n = readline()
  x = 0
  y = 0
  minX = 0
  minY = 0

  while(n--){
    str = readline().split(' ').map(el => +el)
    curx = str[0]
    cury = str[1]

    if(curx){
      if(curx>0)
        x =+ curx
      else if(curx<0)
        minX =+ Math.abs(curx)
    }

    else{
      if(cury>0)
      y =+ cury
    else if(cury<0)
      minY =+ Math.abs(cury)
    }
  }

  ans = (x+y+minX+minY) * 2

  print(ans)
}


process.stdin.resume();
process.stdin.setEncoding('ascii');
var inputString="";
var currentLine=0;

process.stdin.on('data',function(data){
	inputString+=data;

});
process.stdin.on('end',function(){
	inputString=inputString.split('\n');
	main();

});
function readline(){
	return inputString[currentLine++];
}
function main(){
	var t=parseInt(readline());
	 for(let i=0;i<=t-1;i++){
	   var arr=readline().split(' ');
	     drawgiag(arr[0],arr[1]);
	}
}

function drawgiag(n,m){
    n=parseInt(n);
	m=parseInt(m);
	if(n%m==0){
		console.log("YES");
	}
	else{
		console.log("NO");
	}
}

let data = '';
process.stdin.on('data', c => data += c);

const sol = () => {
    let line = data.trim().split('\n');
    let t = Number(line.shift());
    let r = [];
    for(let l of line) {
        let [n, m] = l.split(' ').map(Number);
        r.push((n > m && n%m === 0)?"YES":"NO");
    }
    console.log(r.join('\n'));
};

process.stdin.on('end', sol);

var line = readline();
for (var i = 0; i < line; i++)
    print(getDone());

function getDone() {
    var lines = readline().split(" ");
    return ((lines[0] % lines[1] == 0) ? "YES" : "NO");
}

function processItem() {
  var items = readline().split(' ').map(function(i) { return +i; });
  var x = items[0];
  var y = items[1];

  print(x % y === 0 ? 'YES' : 'NO');
}

function processItems() {
var itemsCount = +readline();
var items = [];

for (var i = 0; i < itemsCount; ++i) {
  processItem();
}

return items;
}

processItems();

process.stdin.resume();
process.stdin.setEncoding('utf8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStd => {
    inputString += inputStd;
});

process.stdin.on('end', function () {
    inputString = inputString.trim().split('\n').map(str => {
        return str.trim();
    });
    main();
});

function readLine() {
    return inputString[currentLine++];
}
function main() {
    const t = +(readLine());
    for (let i = 0; i < t; i++){
        const nums = readLine().split(' ').map(Number);
        const [n, m] = nums;
        const res = n % m;
        console.log((res) ? 'NO' : 'YES');
    }

}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const [n,m] = d.split(' ').map(Number);

  if (n % m === 0) {
    console.log('YES');
  }
  else {
    console.log("NO");
  }

  c++;
});

rl.on('close', () => {

});

let input = ''
process.stdin.on('data', c => input += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    main(input.split(EOL))
})

const main = (lines) => {
    let n = lines[0] * 1

    for (let i = 1; i <= n; i++) {
        let nums = lines[i].split(" ").map(el => el * 1)
        if (nums[0] % nums[1] === 0) {
            console.log("yes")
        } else {
            console.log("no")
        }
    }
}

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
//atcoderのサンプルは最後に改行入れること
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
    var t = nextInt();
    var output = new Array(t);
    for(var i = 0; i < t; i++){
        var one = nextIntArray();
        var n = one[0];
        var m = one[1];
        if(n % m == 0){
            output[i] = "YES";
        }else{
            output[i] = "NO";
        }
    }
    myout(myconv(output,9));
}

const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin
});

let answer = "";

let lines = [];

rl.on('line', (t)=>{
    lines.push(t);
}).on('close', ()=>{
    let t = parseInt(lines[0]);

    for(let i = 1; i <= t; i++)
    {
        let [n,m] = lines[i].split(' ').map(function (x) {
            return parseInt(x);
        });

        if(n % m === 0){
            answer += 'YES\n';
        }
        else{
            answer += 'NO\n';
        }

    }

    console.log(answer);
});

const processData = (lines) => {
  const num = +lines[0]
  for (let j =0; j<num; j++) {
    const [n, m] = lines[j + 1].split(' ').map(x => +x)
    if (n%m === 0) {
      console.log('YES')
    } else {
      console.log('NO')
    }
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

const init = () => {
  process.stdin.resume();
  process.stdin.setEncoding('utf-8');

  let inputString = '';
  let currentLine = 0;

  process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
  });

  process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
      return string.trim();
    });

    main();
  });

  global.readline = () => {
    return inputString[currentLine++];
  };
};

if (typeof readline === 'undefined') {
  init();
}

const print = (...args) => {
  console.log(...args);
};

// Write your logic in main();
// let t = readline().split(' ').map(x => parseInt(x));
const main = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, m] = readline().split(' ').map(x => parseInt(x));
    print((n - m) % m === 0 ? 'YES' : 'NO');
  }
};

function readStringArray() {
  return readline().split(" ");
}
function readNumArray() {
  return readStringArray().map(Number);
}

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var mn = readNumArray();
    var m = mn[0];
    var n = mn[1];
    print(m % n === 0 ? "YES" : "NO");
  }
}
main()

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStd => {
    inputString += inputStd;
});
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(str => {
        return str.trim();
    });
    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
	    const t = +(readLine());
	    for(let i = 0; i < t; i++) {
	    	const nums = readLine().split(' ').map(Number);
		    const [n, m] = nums;
		    const res = n % m;
		    console.log( (res) ? 'NO' : 'YES' );
	    }
}

var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
function main(raw) {
    var lines = raw.trim().split("\n").map(function (v) { return v.split(" ").map(function (u) { return parseInt(u, 10); }); });
    var _a = __read(lines.shift(), 1), t = _a[0];
    while (t > 0) {
        var _b = __read(lines.shift(), 2), n = _b[0], m = _b[1];
        console.log((n - m) % m === 0 || (n - m) % n === 0 ? "YES" : "NO");
        t--;
    }
}
(function () {
    var d = "";
    process.stdin.on("data", function (c) { return d += c; });
    process.stdin.on("end", function () { return main(d); });
})();

var limit = readline()

while(limit > 0){
    var values = readline()
    var valuesSplitted = values.split(" ")
    if(parseInt(valuesSplitted[0]) % parseInt(valuesSplitted[1]) == 0){
        print("YES")
    }else{
        print("NO")
    }
    limit--
}

const readline = require("readline")

function* range(n) {
    let index = 0
    while (index < n) yield index++
}

const simpleReadline = async () => {
    let rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout,
    })
    let p = new Promise((resolve, reject) => {
        rl.question("", (answer) => {
            rl.close()
            resolve(answer)
        })
    })
    return p
}

const main = async () => {
    let n = (await simpleReadline()) * 1
    for await (i of range(n)) {
        let nums = (await simpleReadline()).split(" ").map((el) => el * 1)
        if (nums[0] % nums[1] === 0) {
            console.log("YES")
        } else {
            console.log("NO")
        }
    }
}

main()

const init = () => {
  process.stdin.resume();
  process.stdin.setEncoding('utf-8');

  let inputString = '';
  let currentLine = 0;

  process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
  });

  process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
      return string.trim();
    });

    main();
  });

  global.readline = () => {
    return inputString[currentLine++];
  };
};

if (typeof readline === 'undefined') {
  init();
}

const print = (...args) => {
  console.log(...args);
};

// Write your logic in main();
// let t = readline().split(' ').map(x => parseInt(x));
const main = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, m] = readline().split(' ').map(x => parseInt(x));
    print(Math.ceil(n / 2) === m ? 'YES' : 'NO');
  }
};


/*
* auther yeling
*
*
*/
'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
function print(str) {
    console.log(str);
}

// const { readline, print, testOutput } = require('@ip-algorithmics/codeforces-io');
// main();
// testOutput();

function begin(n) {
    if(n%2 == 0) {
        print(n/2);
        let dis = (n/2) * 3 + 2;
        for(let i = 1; i <= n/2; i++) {
            print(`${(i - 1) * 3 + 1} ${(i - 1) * 3 + 1 + dis}`);
        }
    } else {
        print(Math.ceil(n/2));
        let dis = (n-1)/2 * 3 + 2;
        for(let i = 1; i <= Math.floor(n/2); i++) {
            print(`${(i - 1) * 3 + 1} ${(i - 1) * 3 + 1 + dis}`);
        }
        print(`${2} ${n*3}`);
    }

}

function main() {
    var caseNum = parseInt(readline(), 10);
    for (var i = 0; i < caseNum; i++) {
        var n = parseInt(readline(), 10);
        begin(n);
    }
}

const fs = require("fs");
const input = fs.readFileSync(0, 'utf8').trim().split('\r\n');
let currentline = 0;
function readline(){
      return input[currentline++];
}

function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
function abs(x) {
  return x < 0 ? x*(-1) : x;
}

var T = readline();
var inf = 1000000000000;
for(var tc=1;tc<=T;tc++) {
	var n = readline();
	if(n==1) {
		console.log(1);
		console.log("1 3")
	} else {
		console.log(Math.ceil(n/2));
		for(var i=1;i<=Math.ceil(n/2);i++) console.log(`${(i*3)-1} ${(n-(i-1))*3}`);
	}
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        output[i] = solve(n)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n) {
    // const arr = Array(n).fill('BAN').join('').split('')
    const k = Math.floor(n / 2)
    const ans = []
    for (let i = 0; i < k; i++) {
        const j = n - 1 - i
        const a = 3 * i + 1
        const b = 3 * j + 2
        ans.push([a + 1, b + 1].join(' '))
        // ;[arr[a], arr[b]] = [arr[b], arr[a]]
    }
    if (n & 1) {
        const j = k
        const a = 3 * j + 1
        const b = 3 * j + 2
        ans.push([a + 1, b + 1].join(' '))
        // ;[arr[a], arr[b]] = [arr[b], arr[a]]
    }
    // console.log(arr.join(''))
    ans.unshift(ans.length)
    return ans.join('\n')
}

'use strict';

var fs = require('fs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const n = rn();
  if (n === 1) return `1\n1 2`;
  const res = [],
        str = 'BAN'.repeat(n).split('');
  for (let l = 0, r = str.length - 1; l < r; l++, r--) {
    while (l < r && str[l] !== 'B') {
      l++;
    }
    while (l < r && str[r] !== 'N') {
      r--;
    }
    if (l < r) {
      [str[l], str[r]] = [str[r], str[l]];
      res.push([l + 1, r + 1]);
    }
  }
  return `${res.length}\n${res.map(a => a.join(' ')).join('\n')}`;
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = () => read().split(/\s+/).map(Number);
  const re = () => read().split(/\s+/).map(s => Number(s) - 1);
  const rbs = () => read().split(/\s+/).map(BigInt);
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  try {
    let t = Number(r());
    let res = new Array(t);
    let limit = 0;
    for (let i = 0; i < t; i++) {
      let s = solve(r);
      if (s === undefined) s = '';
      if (t < limit) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      } else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    } else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split(/\r?\n/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();

process.stdin.resume();
process.stdin.setEncoding('utf8');

// your code goes here

// declare global variables
var input_stdin = "";
var lines = "";
var input_currentline = 0;

// standard input is stored into input_stdin
process.stdin.on('data', function (data) {
    input_stdin += data;
});

// standard input is done and stored into an array
process.stdin.on('end', function () {
    lines = input_stdin.split("\n");
    start();
});

function start() {
    const T = parseInt(lines[0])
    let line = 1
    for (let t = 1; t <= T; t++) {
        const n = parseInt(lines[line++].split(' ')[0], 10)
        if (n == 1) {
            console.log(1)
            console.log(1, 2)
        } else {
            const m = parseInt((n+1)/2)
            console.log(m)
            for(let i = 1; i <= m; i++) {
                console.log(i * 3 - 1, (n+1-i)* 3)
            }
        }
    }
}

process.stdin.resume();
process.stdin.setEncoding('utf8');

// your code goes here

// declare global variables
var input_stdin = "";
var lines = "";
var input_currentline = 0;

// standard input is stored into input_stdin
process.stdin.on('data', function (data) {
    input_stdin += data;
});

// standard input is done and stored into an array
process.stdin.on('end', function () {
    lines = input_stdin.split("\n");
    start();
});

function start() {
    const T = parseInt(lines[0])
    let line = 1
    for (let t = 1; t <= T; t++) {
        const n = parseInt(lines[line++].split(' ')[0], 10)
        if (n == 1) {
            console.log(1)
            console.log(1, 2)
        } else {
            console.log(n-1)
            for(let i = 0; i < n-1; i++) {
                console.log(i == 0 ? 2 : i + 3, (i+2) * 3)
            }
        }
    }
}

process.stdin.resume();
process.stdin.setEncoding('utf8');

// your code goes here

// declare global variables
var input_stdin = "";
var lines = "";
var input_currentline = 0;

// standard input is stored into input_stdin
process.stdin.on('data', function (data) {
    input_stdin += data;
});

// standard input is done and stored into an array
process.stdin.on('end', function () {
    lines = input_stdin.split("\n");
    start();
});

function start() {
    const T = parseInt(lines[0])
    let line = 1
    for (let t = 1; t <= T; t++) {
        const n = parseInt(lines[line++].split(' ')[0], 10)
        if (n == 1) {
            console.log(1)
            console.log(1, 2)
        } else {
            console.log(n-1)
            for(let i = 0; i < n-1; i++) {
                console.log(i * 3 + 3, i * 3 + 4)
            }
        }
    }
}

const fs = require("fs");
const input = fs.readFileSync(0, 'utf8').trim().split('\r\n');
let currentline = 0;
function readline(){
      return input[currentline++];
}

function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
function abs(x) {
  return x < 0 ? x*(-1) : x;
}

var T = readline();
var inf = 1000000000000;
for(var tc=1;tc<=T;tc++) {
	var n = readline();
	if(n==1) {
		console.log(1);
		console.log("1 3")
	} else {
		console.log(n-1);
		for(var i=0;i<n-1;i++) console.log(`${(i*3)+2} ${(i*3)+6}`)
	}
}