//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 N = nextInt();
		var alist = nextIntArray(N);
		var blist = nextIntArray(N);
		alist.sort(function(a,b){
			return b - a;
		});
		blist.sort(function(a,b){
			return b - a;
		});
		var isOK = true;
		for(var i = 0; i < N; i++){
			if(blist[i] - alist[i] > 1 || blist[i] - alist[i] < 0){
				isOK = false;
			}
		}
		if(isOK){
			myout("YES");
		}else{
			myout("NO");
		}
	}
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0;
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var yes = true;
            for(j = 0; j < n; j++){
                if(b[j] < a[j] || b[j] > a[j] + 1){
                    yes = false;
                    break;
                }
            }
            console.log(yes ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[j] < a[j] || b[j] > a[j] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = readline().split(' ').map(Number)
    var d = readline().split(' ').map(Number)
    c.sort(function(a,b){
			return b - a;
		});
    d.sort(function(a,b){
			return b - a;
		});
    var point = []
    for(let i = 0; i < b;i++){
      if(c[i] != d[i]){
        point.push(i)
      }
    }
    for(let i = 0; i < point.length;i++){
      if(c[point[i]] != d[i]){
        c[point[i]]++
      }
    }
    var flag = true
    for(let i = 0; i < b;i++){
      if(c[i] != d[i]){
        flag = false
      }
    }
    if(flag){
      print("YES")
    }
    else print("NO")
  }
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = readline().split(' ').map(Number)
    var d = readline().split(' ').map(Number)
    c.sort(function(a,b){
			return b - a;
		});
    d.sort(function(a,b){
			return b - a;
		});
    var flag = true
    for(let i = 0; i < b;i++){
      if(d[i] - c[i] > 1 || d[i] - c[i] < 0){
				flag = false;
			}
    }
    if(flag){
      print("YES")
    }
    else print("NO")
  }
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const a = rna();
		const b = rna();

		a.sort((x, y) => x - y);
		b.sort((x, y) => x - y);

		let ans = true;
		for (let i = 0; i < n; i++) {
			if (a[i] - b[i] != 0 && a[i] - b[i] != -1) ans = false;
		}

		console.log(ans ? 'YES' : 'NO');
	}
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  let a = parseInt(readline());
  while (a--) {
    let b = parseInt(readline());
    let c = readline().split(" ").map(Number);
    let d = readline().split(" ").map(Number);
    c.sort(function (a, b) {
      return b - a;
    });
    d.sort(function (a, b) {
      return b - a;
    });
    let flag = true;
    for (let i = 0; i < b; i++) {
      if (d[i] - c[i] > 1 || d[i] - c[i] < 0) {
        flag = false;
      }
    }
    flag ? print("YES") : print("NO");
  }
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0;
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(a[j] == b[j] || a[j] + 1 == b[j]){

                }else{
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

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++]
        const a = lines[l++].trim().split(' ').map(Number)
        const b = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, a, b)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, a, b) {
    a.sort((x, y) => x - y)
    b.sort((x, y) => x - y)
    // console.log(a)
    // console.log(b)
    for (let i = 0; i < a.length; i++) {
        const d = b[i] - a[i]
        if (d > 1 || d < 0) return 'NO'
    }
    return 'YES'
}

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++]
        const a = lines[l++].trim().split(' ').map(Number)
        const b = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, a, b)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, a, b) {
    a.sort((x, y) => x - y)
    b.sort((x, y) => x - y)
    // console.log(a)
    // console.log(b)
    for (let i = 0; i < a.length; i++) {
        const d = b[i] - a[i]
        if (d > 1) return 'NO'
    }
    return 'YES'
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0;
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(a[j] - 1 == b[j] || a[j] == b[j] || a[j] + 1 == b[j]){

                }else{
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

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

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[i] < a[j] || b[j] > a[j] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[i] < a[i] || b[j] > a[j] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[i] < a[i] || b[i] > a[j] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[i] < a[i] || b[i] > a[i] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[j] < a[i] || b[i] > a[i] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[j] < a[j] || b[i] > a[i] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[j] < a[j] || b[j] > a[i] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[j] < a[j] || b[j] >= a[j] + 1){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var a = 0;
    for(i = 1; i <= t * 3; i++){
        if(i % 3 == 1){
            n = lines[i];
        }else if(i % 3 == 2){
            a = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
        }else{
            var b = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var flag = true;
            for(j = 0; j < n; j++){
                if(b[j] < a[j] || b[j] >= a[j]){
                    flag = false;
                }
            }
            console.log(flag ? 'YES' : 'NO');
        }
    }
});

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = readline().split(' ').map(Number)
    var d = readline().split(' ').map(Number)
    c.sort()
    d.sort()
    var flag = true
    for(let i = 0; i < b;i++){
      if(d[i] - c[i] > 1 || d[i] - c[i] < 0){
				flag = false;
			}
    }
    if(flag){
      print("YES")
    }
    else print("NO")
  }
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = readline().split(' ').map(Number)
    var d = readline().split(' ').map(Number)
    c.sort()
    d.sort()
    var flag = true
    for(let i = 0; i < b;i++){
      if(d[i] - c[i] > 1 || d[i] - c[i] < 0){
				isOK = false;
			}
    }
    if(flag){
      print("YES")
    }
    else print("NO")
  }
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = readline().split(' ').map(Number)
    var d = readline().split(' ').map(Number)
    c.sort()
    d.sort()
    var flag =1
    for(let i = 0; i < b;i++){
      flag &= (c[i] == d[i] || c[i] + 1 == d[i])
    }
    if(flag){
      print("YES")
    }
    else print("NO")
  }
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = readline().split(' ').map(Number)
    var d = readline().split(' ').map(Number)
    c.sort()
    d.sort()
    var point = []
    for(let i = 0; i < b;i++){
      if(c[i] != d[i]){
        point.push(i)
      }
    }
    var flag = 1
    for(let i = 0; i < point.length;i++){
      if(c[point[i]] != d[point[i]]){
        c[point[i]]++
      }
      // flag &= (c[point[i]] == d[point[i]] || c[point[i]] + 1 == d[point[i]])
    }
    for(let i = 0; i < b;i++){
      if(c[i] != d[i]){
        flag = 0
      }
    }
    // for(let i = 0; i < b;i++){
    //   flag &= (c[i] == d[i] || c[i] + 1 == d[i])
    //   print(flag)
    // }
    if(flag){
      print("YES")
    }
    else print("NO")
  }
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = readline().split(' ').map(Number)
    var d = readline().split(' ').map(Number)
    c.sort()
    d.sort()
    var point = []
    for(let i = 0; i < b;i++){
      if(c[i] != d[i]){
        point.push(i)
      }
    }
    for(let i = 0; i < point.length;i++){
      if(c[point[i]] != d[i]){
        c[point[i]]++
      }
    }
    var flag = true
    for(let i = 0; i < b;i++){
      if(c[i] != d[i]){
        flag = false
      }
    }
    if(flag){
      print("YES")
    }
    else print("NO")
  }
}


let ryan = '';//.map(Number).sort(function(a, b){return a - b})
process.stdin.on('data', c => ryan += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = ryan.split(EOL);
    var n = lines[0]
    for(j = 1; j <=n ; j++){
        var g = lines[j].split(''), k = lines[j].split('').sort(), e =k[0] , s=  '', o = 0
        for(l = 0; l < g.length; l++){
            if(e == g[l] ){
                g.splice(l, 1)
                break;
            }
        }
        s = e + ' '
        for(i =0; i < g.length; i++){
            s += g[i]
        }
        console.log(s)

    }
});

var n = readline();
var result = 0;
for (; n>0; n--) {
    var x = readline();
    var y = 'z';
    for(i=0;i<x.length;i++)
    {
      if(y >= x[i]) y = x[i];
    }
    var flg = 0;
    var ans = "";
    for(i=0;i<x.length;i++)
    {
      if(y == x[i] && flg == 0) flg = 1;
      else ans = ans + x[i];
    }
    print(y , ans);
 }

var n = readline();
var result = 0;
for (; n>0; n--) {
    var x = readline();
    var y = 'z';
    for(i=0;i<x.length;i++)
    {
      if(y >= x[i]) y = x[i];
    }
    var flg = 0;
    var ans = "";
    for(i=0;i<x.length;i++)
    {
      if(y == x[i] && flg === 0) flg = 1;
      else ans = ans + x[i];
    }
    print(y , ans);
 }

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var k = lines[i].split('').sort();
        var a = lines[i].split('');
        var l = k[0];
        var ans = l + ' ';
        for(j = 0; j < k.length; j++){
            if(a[j] == l){
                a.splice(j, 1);
                break;
            }
        }
        for(j = 0; j < a.length; j++){
            ans += a[j];
        }
        console.log(ans);
    }
});

function processData(input) {
    var t = 0;
    while(t < +(input[0])) {
        t++;
        const str = [...input[t]];
        const { val, ind = 0 } = str.reduce((acc, val, ind) => {
            if (val < acc.val) return { val, ind };
            return acc;
        }, { val: '{' });
        str.splice(ind, 1);
        console.log( val, str.join(''));
    }
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
let inputString = '';
process.stdin.on("data", function (input) {
    inputString += input;
});

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

    processData(inputString);
});

//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();
	var alpha = "abcdefghijklmnopqrstuvwxyz";
	while(hasNext()){
		var s = next();
		var L = "";
		var R = "";
		for(var i = 0; i < alpha.length; i++){
			if(s.indexOf(alpha[i]) != -1){
				L = alpha[i];
				for(var j = 0; j < s.length; j++){
					if(s.indexOf(alpha[i]) != j){
						R += s[j];
					}
				}
				break;
			}
		}
		myout(L + " " + R);
	}
}

"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 main() {
	let tc = parseInt(readline());
	const result = [];
	while (tc > 0) {
		tc--;
		const word = readline();
		let min = 0;
		let firstLetter = word.charAt(min);
		for (let i = 1; i < word.length; i++) {
			if (word.charAt(i) < firstLetter) {
				min = i;
				firstLetter = word.charAt(min);
			}
		}
		result.push([
			word[min],
			`${word.slice(0, min)}${word.slice(min + 1)}`,
		]);
	}
	for (let i = 0; i < result.length; i++) {
		console.log(`${result[i][0]} ${result[i][1]}`);
	}
}

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

var currentLine = 0;
var inputString = "";

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

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

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

/******** Main function *************/

function main() {
  const t = +input();

  for (let i = 0; i < t; i++) {
    const str = input();
    const arr = str.split("").sort();
    const b = str.replace(arr[0], "");
    console.log(arr[0], b);
  }
}

const iteration_number = readline();
var s,a,b;

for (i=1; i<=iteration_number; i++){
    s= readline()
    var min = 'z';
    for(j=0; j<s.length; j++){
        if(s[j]<min){
            min = s[j]
        }
    }
    print(min+" "+s.replace(min,''));
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0].split(' ').map(Number);
    var n = t[0], k = t[1];
    var a = lines[1].split(' ').map(Number);
    var max = 1;
    var cnt = 1;
    for(i = 1; i < n; i++){
        if(a[i] == a[i - 1]){
            max = cnt;
            cnt = 0;
        }
        cnt++;
    }
    max = cnt;
    console.log(max);
});

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

const iteration_number = readline();
var s,a,b;

for (i=1; i<=iteration_number; i++){
    s= readline()
    var min = 'z';
    for(j=0; j<s.length; j++){
        if(s[i]<min){
            min = s[j]
        }
    }
    print(min+" "+s.replace(min,''));
}


'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++) {
        let target = readline();
        let days = 1;
        let thisDay = 0;
        let chars = {};
        target.split('').forEach((char, i) => {
            if (chars[char] === undefined) {
                thisDay++;
                chars[char] = true;
                if (thisDay === 4) {
                    thisDay = 1;
                    chars = {};
                    chars[char] = true;
                    days++;
                }
            }
        });
        output(days);
    }
}

var limit = parseInt(readline());
for (var i = 0; i < limit; i++)
{
    var caseString = readline();
    var caseMap = new Map();
    var count = 0;
    for (var j = 0; j < caseString.length; j++)
    {
        if (!caseMap.has(caseString[j]))
        {
            if (caseMap.size === 3)
            {
                count++;
                caseMap.clear();
            }
            caseMap.set(caseString[j], 1);
        }
    }
    if (caseMap.size > 0) count++;
    print(count);
}

var tests = parseInt(readline());
    for (var t=0; t < tests; t++) {
        var set = new Set();
        var s = readline();
        var index = 0;
        var ans = 1;
        while (index < s.length) {
            var c = s.charAt(index);
            if (!set.has(c)) {
                if (set.size == 3) {
                    set = new Set();
                    ans++;
                }
                set.add(c);
            }
            index++;
        }
        print(ans);
    }

const main = () => {

	var t = readInt();
	var allans = [];
	for (var zz = 0; zz < t; zz++) {
		var s = readString();
		var cnt = 0;
		var sett = new Set();
		for (var c of s) {
			if (!sett.has(c)) {
				if (sett.size == 3) {
					cnt++;
					sett = new Set();
				}
				sett.add(c);
			}
		}
		cnt++;
		allans.push(cnt);
	}
	multiLineArrayPrint(allans);

	return;
}

const readInt = () => parseInt(readline());
const readString = () => readline();
const readIntArr = () => readline().split(" ").map(zzzz => parseInt(zzzz));
const parseLong = (string) => { // javascript's largest long is < (1<<62)
	var n = string.length;
	var res = 0;
	for (var i = 0; i < n; i++) {
		res *= 10;
		res += parseInt(string[i]);
	}
	return res;
}
const readLong = () => parseLong(readLong());
const readLongArr = () => readline().split(" ").map(zzzz => parseLong(zzzz));
const oneLineArrayPrint = (arr) => print(arr.map(zzzz => zzzz.toString()).join(' '));
const multiLineArrayPrint = (arr) => print(arr.map(zzzz => zzzz.toString()).join('\n'));
const multiLineArrayOfArraysPrint = (arr) => print(arr.map(yyyy => yyyy.map(zzzz => zzzz.toString()).join(' ')).join('\n'));
const makeArr = (defaultVal, dimensionsArr) => {
	var n = dimensionsArr.length;
	if (n === 1) return Array(dimensionsArr[0]).fill(defaultVal);
	else {
		var temp = [];
		for (var i = 0; i < dimensionsArr[0]; i++)
			temp.push(makeArr(defaultVal, dimensionsArr.slice(1)));
		return temp;
	}
}

for (_ = 0; _ < 1; _++) {
	main();
}

// newline for testing
 //newline for testing
// codeforces js cannot use "let" keyword. use "var" instead
// codeforces js cannot destructure arrays

T = readline()
while(T--){
   str = readline().split('')

   acc = []
   ans = 0

   for(i = 0; i < str.length; i++){
      if(acc.indexOf(str[i]) === -1){
         if(acc.length === 3){

            ans++
            acc = []
acc.push(str[i])
         }
         else{
            acc.push(str[i])
         }
      }
   }

   if(acc.length){
      ans++
   }

   print(ans)
}

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;
}
// console.log(input)
var T = readline();
// var inf = 1000000000000;
for(var tc=1;tc<=T;tc++) {
  var n = readline()//.split(' ').map((x) => parseInt(x));
  // var a = readline().split(' ').map((x) => parseInt(x));
  var mp = new Map();
  var f = alph();
  for(var i=0;i<f.length;i++) {
    mp.set(f[i], 0)
  }
  var cnt = 0;
  var ans = 1;
  for(var i=0;i<n.length;i++) {
    if(mp.get(n[i]) == 0) cnt++;
    mp.set(n[i], 1)
    if(cnt == 4) {
      // console.log(["p", i])
      ans++;
      for(var h=0;h<f.length;h++) {
        mp.set(f[h], 0)
      }
      cnt = 1;
      mp.set(n[i], 1)
      // if(i == n.length-1) ans++;
    }
    // if(i == n.length-1 && cnt >= 1) ans++;
  }
  // ans = max(ans, 1);
  console.log(ans)
}

const readline = require('readline');

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

function getStr(str) {
    const letters = []
    let days = 1
    for (let i = 0; i < str.length; i++) {
        if ( !letters.includes(str[i])) {
            if (letters.length === 3) {
                days++;
                letters.pop();
                letters.pop();
                letters.pop();
            }
            letters.push(str[i])
        }
    }
    return days
}
let lines = [];
rl.on('line', (line) => {
    lines.push(line);
}).on('close', () => {
    const [n,...values] = lines
    for (let i = 0; i< n; i++) {
        const ans = getStr(values[i])
        console.log(ans)
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var n = lines[i].split('');
        var ans = 0;
        var st = new Map();
        for(j = 0; j < n.length; j++){
            st.set(n[j], 1);
            if(st.size == 4){
                ans++;
                st = new Map();
                st.set(n[j], 1);
            }
        }
        if(st.size !== 0){
            ans++;
        }
        console.log(ans);
    }
});

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {
    var tests = parseInt(readline());
    for (let t = 0;t < tests; ++t) {
        var s = readline();
        var st = [];
        let ans = 1;
        for (let i = 0;i < s.length-1;++i) {
          let flag = true;
          for (let j = 0;j < st.length; ++j) {
            if (s.charAt(i) == st[j]) {
              flag = false;break;
            }
          }
          if (flag) {
            st.push(s.charAt(i));
          }
          if (st.length > 3) {
            // console.log(st);
            st.splice(0,st.length);
            st.push(s.charAt(i));
            ans++;
          }
        }
        console.log(ans);
    }
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let arr = readline().trim().split("");
    if (arr.length <= 3) {
      console.log(1);
      continue;
    }
    let obj = {},
      cnt = 0,
      day = 0,
      i = 0;
    while (i < arr.length) {
      while (true) {
        if (i >= arr.length) {
          day++;
          break;
        }
        if (!obj[arr[i]]) {
          obj[arr[i]] = 1;
          cnt++;
        }
        if (cnt === 3) {
          day++;
          break;
        }
        i++;
      }
      i++;
      while (obj[arr[i]]) i++;
      obj = {};
      cnt = 0;
    }
    console.log(day);
  }
};
solve();

'use strict';

function solve(s) {
  const n = s.length;
  let res = 0;
  for (let i = 0, j = 0; i < n; i = ++j) {
    let set = new Set([s[i]]);
    while (j + 1 < n && (set.has(s[j + 1]) || set.size < 3)) set.add(s[++j]);
    res++;
  }
  return res;
}

async function main(read) {
  try {
    let t = Number(await read());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      const s = await read();
      res[i] = solve(s);
    }
    return res.join('\n');
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', async () => {
  inputs = str.split('\n').values();
  const output = await main(read);
  process.stdout.write(output);
});

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 str = lines[l++]
        output[i] = solve(str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(str) {
    let ans = 0
    let now = 3
    let map = {}
    for (let i = 0; i < str.length; i++) {
        const x = str[i]
        if (!map[x]) {
            if (now === 3) {
                ans++
                now = 0
                map = {}
            }
            map[x] = 1
            now++
        }
    }
    return ans
}

//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] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}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 nextDoubleArray(size){return nextArray(size, 'double');}
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 nextDouble(){return parseFloat(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 S = next();
		var N = S.length;
		var output = 1;
		var set = new Set();
		for(var i = 0; i < N; i++){
			if(!set.has(S[i])){
				if(set.size == 3){
					set = new Set();
					output++;
				}
				set.add(S[i]);
			}
		}
		myout(output);
	}
}

var limit = parseInt(readline());
for (var i = 0; i < limit; i++)
{
    var caseString = readline();
    var caseMap = new Map();
    var count = 0;
    for (var j = 0; j < caseString.length; j++)
    {
        if (!caseMap.has(caseString[j]))
        {
            if (caseMap.length === 3)
            {
                count++;
                caseMap.clear();
            }
            caseMap.set(caseString[j], 1);
        }
    }
    if (caseMap.length > 0) count++;
    print(count);
}

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;
}
// console.log(input)
var T = readline();
// var inf = 1000000000000;
for(var tc=1;tc<=T;tc++) {
  var n = readline()//.split(' ').map((x) => parseInt(x));
  // var a = readline().split(' ').map((x) => parseInt(x));
  var mp = new Map();
  var f = alph();
  for(var i=0;i<f.length;i++) {
    mp.set(f[i], 0)
  }
  var cnt = 0;
  var ans = 0;
  for(var i=0;i<n.length;i++) {
    if(mp.get(n[i]) == 0) cnt++;
    mp.set(n[i], 1)
    if(cnt == 4) {
      // console.log(["p", i])
      ans++;
      for(var h=0;h<f.length;h++) {
        mp.set(f[h], 0)
      }
      cnt = 1;
      mp.set(n[i], 1)
      if(i == n.length-1) ans++;
    }
    if(i == n.length-1 && cnt > 1) ans++;
  }
  ans = max(ans, 1);
  console.log(ans)
}

const readline = require('readline');

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

function getStr(str) {
    const letters = []
    let days = 1
    for (let i = 0; i < str.length; i++) {
        if (letters.length === 3) {
           days++;
           letters.pop();
            letters.pop();
            letters.pop();
        }
        if ( !letters.includes(str[i])) {
            letters.push(str[i])
        }
    }
    return days
}
let lines = [];
rl.on('line', (line) => {
    lines.push(line);
}).on('close', () => {
    const [n,...values] = lines
    for (let i = 0; i< n; i++) {
        const ans = getStr(values[i])
        console.log(ans)
    }
});


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, k] = lines[l++].trim().split(' ').map(Number)
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, k, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, k, arr) {
    let ans = 0
    const map = Array(k).fill(0)
    arr.forEach(x => {
        const r = x % k
        ans += (x - r) / k
        map[r]++
    })
// console.log(map)
    //
    let i = 1
    let j = k - 1
    while (1) {
        while (i < j && !map[j]) j--
        if (i >= j) break
        while (i < j && (!map[i] || i + j < k)) i++
        if (i >= j) break
        //
        const now = Math.min(map[i], map[j])
        ans += now
        map[i] -= now
        map[j] -= now
    }
    // console.log(map, i, j)
    return ans + (i + i >= k ? Math.floor((map[i] || 0) / 2) : 0)
}

'use strict';

function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }

  return obj;
}

function solve(n, m, a) {
  const map = new Map();
  for (let num of a) {
    const b = num % m;
    if (!map.has(b)) map.set(b, []);
    map.get(b).push(num);
  }
  let res = 0;
  for (let [b, arr] of map) {
    const b1 = (m - b) % m;
    if (b === b1) {
      while (arr.length > 1) {
        const c = arr.pop(),
              d = arr.pop();
        res += (c + d) / m;
      }
    } else {
      while (arr.length && (_map$get = map.get(b1)) !== null && _map$get !== void 0 && _map$get.length) {
        var _map$get;
        const c = arr.pop(),
              d = map.get(b1).pop();
        res += (c + d) / m;
      }
    }
  }
  const keys = [...map.entries()].filter(([, values]) => values.length > 0).map(([k]) => k).sort((a, b) => b - a);
  const bst = new BinarySearchTree();
  for (let k of keys) {
    bst.insert(k);
  }
  for (let k of keys) {
    const arr = map.get(k);
    let t = bst.ceiling(m - k);
    while (arr.length && (k === t ? arr.length > 1 : (_map$get2 = map.get(t)) === null || _map$get2 === void 0 ? void 0 : _map$get2.length)) {
      var _map$get2, _map$get3;
      const c = arr.pop(),
            d = map.get(t).pop();
      res += Math.floor((c + d) / m);
      if (!arr.length) {
        bst.delete(k);
      }
      if (k !== t && !((_map$get3 = map.get(t)) !== null && _map$get3 !== void 0 && _map$get3.length)) {
        bst.delete(t);
      }
      t = bst.ceiling(m - k);
    }
  }
  const nums = [...map.entries()].filter(([, values]) => values.length > 0).sort((a, b) => b[0] - a[0]).map(([, values]) => values).flat();
  for (let i = 0; i < nums.length; i += 2) {
    res += Math.floor((nums[i] + nums[i + 1]) / m);
  }
  return res;
}
class BinarySearchTree {
  constructor(_compare = (a, b) => a - b) {
    _defineProperty(this, "root", null);
    _defineProperty(this, "length", 0);
    _defineProperty(this, "min", null);
    _defineProperty(this, "max", null);
    _defineProperty(this, "minCache", true);
    _defineProperty(this, "maxCache", true);
    this._compare = _compare;
    this.compare = this.compare.bind(this);
  }
  isT(t) {
    return t !== undefined && t !== null;
  }
  compare(a, b) {
    const {
      isT
    } = this;
    if (isT(a) && isT(b)) return this._compare(a, b);
    if (isT(a)) return 1;
    if (isT(b)) return -1;
    return 0;
  }
  isEmpty() {
    return !this.root;
  }
  size() {
    return this.root ? this.root.size : 0;
  }
  getRoot() {
    return this.root;
  }
  getMin() {
    if (this.minCache) {
      return this.min;
    }
    const min = this.searchKth(this.size());
    this.min = min;
    this.minCache = true;
    return min;
  }
  getMax() {
    if (this.maxCache) {
      return this.max;
    }
    const max = this.searchKth(1);
    this.max = max;
    this.maxCache = true;
    return max;
  }
  balance(node) {
    node.height = this.getHeight(node);
    const blance = this.getBalance(node);
    let res;
    if (Math.abs(blance) === 2) {
      if (blance > 0) {
        var _node$left$left$heigh, _node$left, _node$left$left, _node$left$right$heig, _node$left2, _node$left2$right;
        const heightDif = ((_node$left$left$heigh = (_node$left = node.left) === null || _node$left === void 0 ? void 0 : (_node$left$left = _node$left.left) === null || _node$left$left === void 0 ? void 0 : _node$left$left.height) !== null && _node$left$left$heigh !== void 0 ? _node$left$left$heigh : 0) - ((_node$left$right$heig = (_node$left2 = node.left) === null || _node$left2 === void 0 ? void 0 : (_node$left2$right = _node$left2.right) === null || _node$left2$right === void 0 ? void 0 : _node$left2$right.height) !== null && _node$left$right$heig !== void 0 ? _node$left$right$heig : 0);
        if (heightDif > 0) {
          res = this.rotateRight(node);
        } else if (heightDif < 0) {
          res = this.rotateLeftRight(node);
        }
      } else {
        var _node$right$left$heig, _node$right, _node$right$left, _node$right$right$hei, _node$right2, _node$right2$right;
        const heightDif = ((_node$right$left$heig = (_node$right = node.right) === null || _node$right === void 0 ? void 0 : (_node$right$left = _node$right.left) === null || _node$right$left === void 0 ? void 0 : _node$right$left.height) !== null && _node$right$left$heig !== void 0 ? _node$right$left$heig : 0) - ((_node$right$right$hei = (_node$right2 = node.right) === null || _node$right2 === void 0 ? void 0 : (_node$right2$right = _node$right2.right) === null || _node$right2$right === void 0 ? void 0 : _node$right2$right.height) !== null && _node$right$right$hei !== void 0 ? _node$right$right$hei : 0);
        if (heightDif > 0) {
          res = this.rotateRightLeft(node);
        } else if (heightDif < 0) {
          res = this.rotateLeft(node);
        }
      }
    }
    return res ? res : node;
  }
  rotateRight(node) {
    const left = node.left;
    const leftRight = left.right;
    left.right = node;
    node.left = leftRight;
    node.height = this.getHeight(node);
    left.height = this.getHeight(left);
    node.size = this.getSize(node);
    left.size = this.getSize(left);
    return left;
  }
  rotateLeft(node) {
    const right = node.right;
    const rightLeft = right.left;
    right.left = node;
    node.right = rightLeft;
    node.height = this.getHeight(node);
    right.height = this.getHeight(right);
    node.size = this.getSize(node);
    right.size = this.getSize(right);
    return right;
  }
  rotateLeftRight(node) {
    node.left = this.rotateLeft(node.left);
    return this.rotateRight(node);
  }
  rotateRightLeft(node) {
    node.right = this.rotateRight(node.right);
    return this.rotateLeft(node);
  }
  getBalance(node) {
    return this.getHeight(node.left) - this.getHeight(node.right);
  }
  getHeight(node) {
    var _node$left$height, _node$left3, _node$right$height, _node$right3;
    if (!node) return 0;
    return Math.max((_node$left$height = (_node$left3 = node.left) === null || _node$left3 === void 0 ? void 0 : _node$left3.height) !== null && _node$left$height !== void 0 ? _node$left$height : 0, (_node$right$height = (_node$right3 = node.right) === null || _node$right3 === void 0 ? void 0 : _node$right3.height) !== null && _node$right$height !== void 0 ? _node$right$height : 0) + 1;
  }
  getSize(node) {
    var _node$left$size, _node$left4, _node$right$size, _node$right4;
    if (!node) return 0;
    return ((_node$left$size = (_node$left4 = node.left) === null || _node$left4 === void 0 ? void 0 : _node$left4.size) !== null && _node$left$size !== void 0 ? _node$left$size : 0) + ((_node$right$size = (_node$right4 = node.right) === null || _node$right4 === void 0 ? void 0 : _node$right4.size) !== null && _node$right$size !== void 0 ? _node$right$size : 0) + node.count;
  }
  createNode(val) {
    return {
      id: Math.random() * new Date().valueOf(),
      val,
      left: null,
      right: null,
      size: 1,
      height: 1,
      count: 1
    };
  }
  insert(val) {
    let cur = this.createNode(val);
    if (this.isEmpty()) {
      this.root = cur;
      this.length++;
    } else {
      [, cur] = this.insertNode(this.root, cur);
    }
    if (this.min === null || this.compare(this.min, val) > 0) {
      this.min = val;
    }
    if (this.max === null || this.compare(this.max, val) < 0) {
      this.max = val;
    }
  }
  insertNode(node, cur, parent = null) {
    node.size++;
    const compareResult = this.compare(cur.val, node.val);
    let res;
    if (compareResult === 0) {
      node.count++;
      return [false, node];
    } else if (compareResult > 0) {
      if (node.right) {
        res = this.insertNode(node.right, cur, node);
        if (!res[0]) return res;
      } else {
        node.right = cur;
        this.length++;
        res = [true, cur];
      }
    } else {
      if (node.left) {
        res = this.insertNode(node.left, cur, node);
        if (!res[0]) return res;
      } else {
        node.left = cur;
        this.length++;
        res = [true, cur];
      }
    }
    let preHeight = node.height;
    const newNode = this.balance(node);
    if (newNode === node && node.height === preHeight) {
      res = [false, res[1]];
    } else if (newNode !== node) {
      if (parent) {
        parent.left === node ? parent.left = newNode : parent.right = newNode;
      } else {
        this.root = newNode;
      }
      res = [false, res[1]];
    }
    return res;
  }
  delete(val) {
    if (!this.root) return;
    this.deleteNode(val, this.root, null);
  }
  deleteNode(val, node, parent) {
    if (!node) return null;
    let res = this.compare(val, node.val);
    if (res === 0) {
      node.count--;
      node.size--;
      if (node.count > 0) return node;
      if (!node.left || !node.right) {
        if (this.min === val) {
          this.minCache = false;
        }
        if (this.max === val) {
          this.maxCache = false;
        }
        this.length--;
        if (!parent) {
          var _node$left5;
          this.root = (_node$left5 = node.left) !== null && _node$left5 !== void 0 ? _node$left5 : node.right;
          return this.root;
        } else {
          var _node$left6;
          return (_node$left6 = node.left) !== null && _node$left6 !== void 0 ? _node$left6 : node.right;
        }
      } else {
        const selectLeft = node.left.height > node.right.height;
        let replaceNode = selectLeft ? this.pre(node) : this.next(node),
            name = selectLeft ? 'left' : 'right';
        node.val = replaceNode.val;
        node.count = replaceNode.count;
        replaceNode.count = 0;
        node[name] = this.deleteNode(replaceNode.val, node[name], node);
      }
    } else if (res > 0) {
      node.right = this.deleteNode(val, node.right, node);
    } else {
      node.left = this.deleteNode(val, node.left, node);
    }
    node.size = this.getSize(node);
    node.height;
    const newNode = this.balance(node);
    if (parent) {
      parent.left === node ? parent.left = newNode : parent.right = newNode;
    } else {
      this.root = newNode;
    }
    return newNode;
  }
  next(node) {
    let next = node.right;
    while ((_next = next) !== null && _next !== void 0 && _next.left) {
      var _next;
      next = next.left;
    }
    return next;
  }
  pre(node) {
    let pre = node.left;
    while ((_pre = pre) !== null && _pre !== void 0 && _pre.right) {
      var _pre;
      pre = pre.right;
    }
    return pre;
  }
  search(val, compare) {
    if (this.isEmpty()) {
      return null;
    }
    const [, node] = this.searchCeilingNode(this.root, val, compare !== null && compare !== void 0 ? compare : this.compare);
    return node.val;
  }
  searchCeilingNode(node, val, compare, parent = null) {
    const res = compare(val, node.val);
    if (res === 0) {
      return [parent, node];
    } else if (res > 0) {
      if (node.right) {
        return this.searchCeilingNode(node.right, val, compare, node);
      } else {
        return [parent, node];
      }
    } else {
      if (node.left) {
        const [p, value] = this.searchCeilingNode(node.left, val, compare, node);
        if (compare(value.val, val) < 0) {
          return [parent, node];
        } else {
          return [p, value];
        }
      } else {
        return [parent, node];
      }
    }
  }
  ceiling(val) {
    if (this.isEmpty()) {
      return null;
    }
    const [, node] = this.searchCeilingNode(this.root, val, this.compare);
    return this.compare(node.val, val) >= 0 ? node.val : null;
  }
  searchFloorNode(node, val, compare, parent = null) {
    const res = compare(val, node.val);
    if (res === 0) {
      return [parent, node];
    } else if (res > 0) {
      if (node.right) {
        const [p, value] = this.searchFloorNode(node.right, val, compare, node);
        if (compare(value.val, val) > 0) {
          return [parent, node];
        } else {
          return [p, value];
        }
      } else {
        return [parent, node];
      }
    } else {
      if (node.left) {
        return this.searchFloorNode(node.left, val, compare, node);
      } else {
        return [parent, node];
      }
    }
  }
  floor(val) {
    if (this.isEmpty()) {
      return null;
    }
    const [, node] = this.searchFloorNode(this.root, val, this.compare);
    return this.compare(node.val, val) <= 0 ? node.val : null;
  }
  searchKth(k) {
    if (this.isEmpty()) {
      return null;
    }
    if (k <= 0 || k > this.size()) {
      return null;
    }
    const node = this.searchNodeKth(this.root, k);
    return node.val;
  }
  searchNodeKth(node, k) {
    var _node$right$size2, _node$right5, _node$right$size3, _node$right6;
    const rSize = (_node$right$size2 = (_node$right5 = node.right) === null || _node$right5 === void 0 ? void 0 : _node$right5.size) !== null && _node$right$size2 !== void 0 ? _node$right$size2 : 0;
    if (rSize === k - 1 || rSize < k && rSize + node.count >= k) return node;
    if (node.right && rSize > k - 1) return this.searchNodeKth(node.right, k);else return this.searchNodeKth(node.left, k - ((_node$right$size3 = (_node$right6 = node.right) === null || _node$right6 === void 0 ? void 0 : _node$right6.size) !== null && _node$right$size3 !== void 0 ? _node$right$size3 : 0) - node.count);
  }
  countGreaterThanEq(val) {
    if (!this.root) return 0;
    return this.countCompare(val, (a, b) => this._compare(a, b), this.root);
  }
  countCompare(val, compare, node, pre = 0) {
    const res = compare(val, node.val);
    if (res === 0) {
      var _node$right$size4, _node$right7;
      return pre + ((_node$right$size4 = (_node$right7 = node.right) === null || _node$right7 === void 0 ? void 0 : _node$right7.size) !== null && _node$right$size4 !== void 0 ? _node$right$size4 : 0) + node.count;
    } else if (res > 0) {
      if (node.right) {
        return this.countCompare(val, compare, node.right, pre);
      } else {
        return pre;
      }
    } else {
      var _node$right$size5, _node$right8;
      let count = pre + ((_node$right$size5 = (_node$right8 = node.right) === null || _node$right8 === void 0 ? void 0 : _node$right8.size) !== null && _node$right$size5 !== void 0 ? _node$right$size5 : 0) + node.count;
      if (node.left) {
        return this.countCompare(val, compare, node.left, count);
      } else {
        return count;
      }
    }
  }
  toArray() {
    if (!this.root) return [];
    const res = [];
    const dfs = node => {
      if (node.left) dfs(node.left);
      res.push(node.val);
      if (node.right) dfs(node.right);
    };
    dfs(this.root);
    return res;
  }
}

async function main(read) {
  try {
    let res = [];
    let t = Number(await read());
    while (t--) {
      const [n, m] = (await read()).split(' ').map(Number);
      const a = (await read()).split(' ').map(Number);
      res.push(solve(n, m, a));
    }
    console.log(res.join('\n'));
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', () => {
  inputs = str.split('\n').values();
  main(read);
});

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, k] = lines[l++].trim().split(' ').map(Number)
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, k, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, k, arr) {
    let ans = 0
    const map = Array(k).fill(0)
    arr.forEach(x => {
        const r = x % k
        ans += (x - r) / k
        map[r]++
    })
// console.log(map)
    //
    let i = 1
    let j = k - 1
    while (1) {
        while (i < j && !map[j]) j--
        if (i >= j) break
        while (i < j && (!map[i] || i + j < k)) i++
        if (i >= j) break
        //
        const now = Math.min(map[i], map[j])
        ans += now
        map[i] -= now
        map[j] -= now
    }
    // console.log(map, i, j)
    return ans + Math.floor((map[i] || 0) / 2)
}

'use strict';

function solve(n, m, a) {
  const map = new Map();
  for (let num of a) {
    const b = num % m;
    if (!map.has(b)) map.set(b, []);
    map.get(b).push(num);
  }
  let res = 0;
  for (let [b, arr] of map) {
    const b1 = (m - b) % m;
    if (b === b1) {
      while (arr.length > 1) {
        const c = arr.pop(),
              d = arr.pop();
        res += (c + d) / m;
      }
    } else {
      while (arr.length && (_map$get = map.get(b1)) !== null && _map$get !== void 0 && _map$get.length) {
        var _map$get;
        const c = arr.pop(),
              d = map.get(b1).pop();
        res += (c + d) / m;
      }
    }
  }
  const nums = [...map.entries()].filter(([, values]) => values.length > 0).sort((a, b) => b[0] - a[0]).map(([, values]) => values).flat();
  for (let i = 0; i < nums.length; i += 2) {
    res += Math.floor((nums[i] + nums[i + 1]) / m);
  }
  return res;
}

async function main(read) {
  try {
    let res = [];
    let t = Number(await read());
    while (t--) {
      const [n, m] = (await read()).split(' ').map(Number);
      const a = (await read()).split(' ').map(Number);
      res.push(solve(n, m, a));
    }
    console.log(res.join('\n'));
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', () => {
  inputs = str.split('\n').values();
  main(read);
});


var t = parseInt(readline());

while(t--)
{
    var input = readline().split(" ").map(function(x) { return parseInt(x); });
    var x = input[0];
    var y = input[1];
    var a = input[2];
    var b = input[3];

    var xy = Math.abs(x - y);
    var ab = a + b;
    if (xy % ab == 0)
        print(xy / ab);
    else
        print(-1);
}

const main = (data) => {
  const n = data[0];

  for (let i = 1; i <= n; i++) {
    const [x, y, a, b] = data[i].split(' ').map(x => +x);

    if (Math.abs(x - y) % (a + b) == 0) {
      console.log(Math.abs(x - y) / (a + b));
    } else {
      console.log(-1);
    }
  }
};

let data = '';

process.stdin.on('data', input => data += input);
process.stdin.on('end', () => {
  data = data.split('\n');

  main(data);
});

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

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main(arr)
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}

function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

function main(input) {
  let ptr = 0
  let t = readInt(input, ptr++)
  while(t--) {
    const [x, y, a, b] = readInts(input, ptr++)
    if((y - x) % (a + b) === 0) wr((y - x) / (a + b))
    else wr( -1)

  }
}

// https://codeforces.com/problemset/problem/1304/A
"use strict";

// Interface of codeforces.com
const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let n = NaN;
let input = [];
rl.on("line", line => {
  let output = NaN;
  input = line.split(" ").map(x => parseInt(x));
  if (isNaN(n)) {
    n = input[0];
  } else {
    output = solution(input);
    console.log(output);
  }
});
rl.on("close", () => {
  // console.log(input)
});
// End of interface
const solution = function(inputs) {
  let x = inputs[0];
  let y = inputs[1];
  let a = inputs[2];
  let b = inputs[3];

  let distance = y - x;
  let steps = a + b;
  if (distance % steps == 0) {
    return distance / steps;
  } else {
    return -1;
  }
};

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;
  }

  let [x, y, a, b] = d.split(' ').map(Number);
  let n = Math.abs(x - y);
  let ans = n % (a + b) ? -1 : n / (a + b);

  console.log(ans);

  c++;
});

/**
 * @author Sunwarul Islam
 * JavaScript Developer
*/
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 arr = readLine().split(' ').map(Number);
        const [x, y, a, b] = arr;
        const diff = y - x;
        const total = a + b;
        if (diff % total !== 0) {
            console.log('-1');
        } else {
            console.log(diff / total);
        }
    }
}

var data = "";

process.stdin.on("data", x => data += x);

// process.on("SIGINT", () => {
process.stdin.on("end", () => {

	var eol = data.indexOf("\r") ? (data.indexOf("\n") ? "\r\n" : "\r") : "\n";

	var lines = data.split(eol);

	var n = +lines.shift();

	for(let i = 0; i < n; i++) {

		var arr = [];
		var l = f.length;
		for(let ii = 0; ii < l; ii++) arr.push(lines[l*i+ii]);
		f.apply({}, arr);
	}

	process.exit(0);
});

function f(c) {

	var [x, y, a, b] = c.split(" ").map(x => +x);
	var val = (y-x)/(a+b);
	console.log(Number.isInteger(val) ? val : -1);
}

var data = "";

process.stdin.on("data", x => data += x);

// process.on("SIGINT", () => {
process.stdin.on("end", () => {

    var eol = data.indexOf("\r")+1 ? (data.indexOf("\n")+1 ? "\r\n" : "\r") : "\n";

    var lines = data.split(eol);

    var n = +lines.shift().split(" ")[0];

    if(lines[lines.length-1] == "") lines.pop();

    for(let i = 0; i < n; i++) {

        var arr = [];
        var l = f.length;
        for(let ii = 0; ii < l; ii++) arr.push(lines[l*i+ii]);
        if(!l) {
            arr = lines;
            i = n;
        }
        f.apply({}, arr);
    }

	console.log(ans);

    process.exit(0);
});

var ans = "";

function f(c) {
	var [x, y, a, b] = c.split(" ").map(x => +x);
	var val = (y-x)/(a+b);
	ans += (Number.isInteger(val) ? val : -1) + " ";
}

var data = "";

process.stdin.on("data", x => data += x);

// process.on("SIGINT", () => {
process.stdin.on("end", () => {

    var eol = data.indexOf("\r")+1 ? (data.indexOf("\n")+1 ? "\r\n" : "\r") : "\n";

    var lines = data.split(eol);

    var n = +lines.shift().split(" ")[0];

    if(lines[lines.length-1] == "") lines.pop();

    for(let i = 0; i < n; i++) {

        var arr = [];
        var l = f.length;
        for(let ii = 0; ii < l; ii++) arr.push(lines[l*i+ii]);
        if(!l) {
            arr = lines;
            i = n;
        }
        f.apply({}, arr);
    }

    process.exit(0);
});

function f(c) {
	var [x, y, a, b] = c.split(" ").map(x => +x);
	var val = (y-x)/(a+b);
	console.log(Number.isInteger(val) ? val : -1);
}

let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split(/[\r\n]/).filter(data => data.length > 0);
txt.shift()

for (let i = 0; i < txt.length; i++) {
    doit(...txt[i].split(" ").filter(data=>data.length>0).map(data=>data*1))

}

function doit(x,y,a,b) {
    let r=(y-x)/(a+b);

    if(r==Math.floor(r)){
        console.log(r);

    }else{
        console.log(-1);

    }

}

var tests = parseInt(readline())
for (var i = 0; i < tests; i++){
    var interim = readline().split(' ').map((val)=>{
        return parseInt(val);
        })
    var res = (interim[1] - interim[0])/(interim[2]+interim[3])
    print(Number.isInteger(res) ? res : -1)
}

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
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 = myconv(next(),1);
  var output = new Array(t);
  for(var i = 0; i < t; i++){
      var tmp = myconv(next(),4);
      var x = tmp[0];
      var y = tmp[1];
      var a = tmp[2];
      var b = tmp[3];
      if((y - x) % (a + b) == 0){
          output[i] = (y - x) / (a + b);
      }else{
          output[i] = "-1";
      }
  }
  myout(myconv(output,9));
}

var z = parseInt(readline());

var a;
var b;
var c;
var d;

for(var i=0; i<z; i++){

    var l = readline().split(' ');

    a = parseInt(l[0]);
    b = parseInt(l[1]);
    c = parseInt(l[2]);
    d = parseInt(l[3]);

    if(Math.floor((b-a)/(c+d)) === (b-a)/(c+d)){
        print((b-a)/(c+d));
    }
    else{
        print(-1);
    }
}

var data = "";

process.stdin.on("data", x => data += x);

// process.on("SIGINT", () => {
process.stdin.on("end", () => {

    var eol = data.indexOf("\r")+1 ? (data.indexOf("\n")+1 ? "\r\n" : "\r") : "\n";

    var lines = data.split(eol);

    var n = +lines.shift().split(" ")[0];

    if(lines[lines.length-1] == "") lines.pop();

    for(let i = 0; i < n; i++) {

        var arr = [];
        var l = f.length;
        for(let ii = 0; ii < l; ii++) arr.push(lines[l*i+ii]);
        if(!l) {
            arr = lines;
            i = n;
        }
        f.apply({}, arr);
    }

	console.log(ans);

    process.exit(0);
});

var ans = "";

function f(c) {
	var [x, y, a, b] = c.split(" ").map(x => +x);
	var val = (y-x)/(a+b);
	ans += Number.isInteger(val) ? val : -1 + " ";
}


var repeatTimes = readline();

while (repeatTimes--) {
    var n = readline()
    var s = readline()
    var oper = 0
    for (var i = 0; i < s.length; i++) {
        if ((s[0] === '(') && (s[1] === ')')) {
            s = s.slice(2)
            i = 0
            oper++
        } else if ((s[i] == s[0]) && (i !== 0)) {
            s = s.slice(i + 1)
            i = 0
            oper++
        }
    }

    print(oper, ' ', s.length)
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline().trim();
    const checkPalindrome = (start, end, str) => {
      let i = start,
        j = end;
      while (i <= j) {
        if (str[i] !== str[j]) return false;
        i++;
        j--;
      }
      return true;
    };
    let i = 0,
      j = i + 1,
      cnt = 0;
    while (i + 1 < n) {
      if (arr[i] === "(") {
        cnt++;
        i += 2;
        j = i + 1;
      } else {
        while (arr[i] !== arr[j] && j < n) j++;
        if (j > n) break;
        else {
          if (checkPalindrome(i, j, arr)) {
            i = j + 1;
            j = i + 1;
            cnt++;
          } else j++;
        }
      }
    }
    if (i === n) console.log(`${cnt} ${0}`);
    else if (i === n - 1) console.log(`${cnt} ${1}`);
    else console.log(`${cnt} ${n - i}`);
  }
};
solve();

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++]
        const str = lines[l++]
        output[i] = solve(n, str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, str) {
    let i = 0
    let op = 0
    while (i < n) {
        if (str[i] === '(') {
            if (i + 1 < n) {
                op++
                i += 2
            } else {
                break
            }
        } else {
            let j = i + 1
            while (j < n && str[j] === '(') j++
            if (j < n) {
                op++
                i = j + 1
            } else {
                break
            }
        }
    }
    return op + ' ' + (n - i)
}

'use strict'; /*jslint node:true, browser:true, es6:true*/
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
const print = console.log
const lines = []
rl.on('line', line => {
    lines.push(line);
});
rl.on('close', main)
let rli = 0;
function readline() {
    return lines[rli++];
}
const EPS = 1e-6;

function is_polindrom(s, from, to){
  while (from<to && s[from]==s[to]){
    to--;
    from++;
  }
  return from>=to;
}
function is_formula(s, from, to){
  let cnt = 0;
  for (;from<=to; from++){
    if (s[from]=='(')
      cnt++;
      else
      cnt--;
    if (cnt<0)
      return false;
  }
  return cnt==0;
}

function is_good(s, from, to){
  if (is_polindrom(s, from, to))
    return true;
  if (is_formula(s, from, to))
    return true;
}

function calc(s){
  let cnt = 0, remaining = 0;
  let start = 0;
  while (start<s.length){
    let was_good;
    for (let i=2; start+i-1<s.length; i++){
      if (is_good(s, start, start+i-1)){
        was_good = true;
        start = start+i;
        break;
      }
    }
    if (!was_good){
      remaining = s.length-start;
      break;
    }
    cnt++;
  }
  print(cnt, remaining)
}

function main() {
    let T = +readline();
    while (T--){
      let n = +readline();
      let str = readline();
      calc(str)
    }
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            n = lines[i];
        }else{
            var k = lines[i].split('');
            var a = 0, b = 0;
            for(j = 1; j < n; j++){
                if(k[b] == '(' && k[j] == ')' || k[b] == k[j]){
                    j++, a++;
                    b = j;
                }
            }
            console.log(a, n - b);
        }
    }
});

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++];
}

/***
Educational Codeforces Round 125 (Div. 2)
2022-03-22

C. Bracket Sequence Deletion
***/

function main() {
  // INPUT: Number of test cases
  let t = readline();
  t = parseInt(t);
  let l, seq;
  for (let i = 0; i < t; i++) {
    // INPUT: the length of the bracket sequence
    l = readline();
    l = parseInt(l);
    // INPUT: the bracket sequence
    seq = readline();

    // # of operations doable (we can greed this one)
    let numOps = 0;
    // position pointers
    let start = 0;
    let end = 1; // semi-open interval
    while (end <= l) {
      const curSeq = seq.slice(start, end);
      if (isRegular(curSeq) || isPalindromic(curSeq)) {
        numOps++;
        start = end;
      }
      end++;
    }
    console.log(numOps + ' ' + (end - start - 1));
  }
}

function isRegular(seq) {
  let open = 0;
  for (let i = 0; i < seq.length; i++) {
    if (seq.charAt(i) === '(') {
      open++;
    } else {
      open--;
      if (open < 0) {
        return false;
      }
    }
  }
  return open === 0;
}

function isPalindromic(seq) {
  for (let i = 0; i < seq.length/2; i++) {
    if (seq.charAt(i) !== seq.charAt(seq.length - i - 1)) {
      return false;
    }
  }
  return seq.length >= 2;
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline().trim();
    const checkPalindrome = (start, end, str) => {
      let i = 0,
        j = end;
      while (i <= j) {
        if (str[i] !== str[j]) return false;
        i++;
        j--;
      }
      return true;
    };
    let i = 0,
      j = i + 1,
      cnt = 0;
    while (i + 1 < n) {
      if (arr[i] === "(") {
        cnt++;
        i += 2;
        j = i + 1;
      } else {
        while (arr[i] !== arr[j] && j < n) j++;
        if (j > n) break;
        else {
          if (checkPalindrome(i, j, arr)) {
            i = j + 1;
            j = i + 1;
            cnt++;
          } else j++;
        }
      }
    }
    if (i === n) console.log(`${cnt} ${0}`);
    else if (i === n - 1) console.log(`${cnt} ${1}`);
    else console.log(`${cnt} ${n - i}`);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline().trim();
    const checkPalindrome = (start, end, str) => {
      let i = 0,
        j = end;
      while (i <= j) {
        if (str[i] !== str[j]) return false;
        i++;
        j--;
      }
      return true;
    };
    let i = 0,
      j = n - 1,
      cnt = 0;
    while (i + 1 < n) {
      if (arr[i] === "(") {
        cnt++;
        i += 2;
      } else {
        while (arr[i] !== arr[j]) j--;
        if (i !== j) {
          if (checkPalindrome(i, j, arr)) {
            i = j + 1;
            j = n - 1;
            cnt++;
          } else j--;
        } else break;
      }
    }
    if (i === n) console.log(`${cnt} ${0}`);
    else if (i === n - 1) console.log(`${cnt} ${1}`);
    else console.log(`${cnt} ${n - i}`);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline().trim();
    const checkPalindrome = (start, end, str) => {
      let i = 0,
        j = end;
      while (i <= j) {
        if (str[i] !== str[j]) return false;
        i++;
        j--;
      }
      return true;
    };
    const checkValid = (start, end, str) => {
      let o = 0,
        c = 0;
      while (start <= end) {
        if (str[start] === "(") o++;
        else c++;
        if (c > o) return false;
        start++;
      }
      if (o === c) return true;
    };
    let i = 0,
      j = n - 1,
      len = n,
      cnt = 0;

    while (i < j) {
      if (arr[i] === arr[j]) {
        if (checkPalindrome(i, j, arr)) {
          i = j + 1;
          j = n - 1;
          if (i > j) len = 0;
          else if (i === j) len = 1;
          else len = j - i + 1;
          cnt++;
          continue;
        }
      } else if (arr[i] === "(" && arr[j] === ")") {
        if (checkValid(i, j, arr)) {
          i = j + 1;
          j = n - 1;
          if (i > j) len = 0;
          else if (i === j) len = 1;
          else len = j - i + 1;
          cnt++;
          continue;
        }
      }
      j--;
    }
    console.log(`${cnt} ${len}`);
  }
};
solve();

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++]
        const str = lines[l++]
        output[i] = solve(n, str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, str) {
    let i = 0
    let op = 0
    while (i < n) {
        let j = i
        let level = 0
        let fa = false
        while (j < n) {
            if (str[j] === '(') {
                level++
            } else {
                level--
            }
            if (level < 0) break
            if (!level) {
                fa = true
                break
            }
            j++
        }
        const a = fa ? j : i
        //
        j = i + 1
        let fb = false
        while (j < n) {
            if (isp(str, i, j)) {
                fb = true
                break
            }
            j++
        }
        const b = fb ? j : i
        j = Math.max(a, b)
    // console.log(a, b)
        if (i === j) break
        op++
        i = j + 1
    }
    return op + ' ' + (n - i)
}
function isp(str, i, j) {
    while (i < j) {
        if (str[i] !== str[j]) return false
        i++
        j--
    }
    return true
}

'use strict'; /*jslint node:true, browser:true, es6:true*/
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
const print = console.log
const lines = []
rl.on('line', line => {
    lines.push(line);
});
rl.on('close', main)
let rli = 0;
function readline() {
    return lines[rli++];
}
const EPS = 1e-6;

function is_polindrom(s, from, to){
  while (from<to && s[from]==s[to]){
    to--;
    from++;
  }
  return from>=to;
}
function is_formula(s, from, to){
  let cnt = 0;
  for (;from<=to; from++){
    if (s[from]=='(')
      cnt++;
      else
      cnt--;
    if (cnt<0)
      return false;
  }
  return cnt==0;
}

function is_good(s, from, to){
  if (is_polindrom(s, from, to))
    return true;
  if (is_formula(s, from, to))
    return true;
}

function calc(s){
  let cnt = 0, remaining = 0;
  let start = 0;
  while (start<s.length){
    let was_good;
    for (let i=2; start+i-1<s.length; i++){
      if (is_good(s, start, start+i-1)){
        was_good = true;
        start = start+i;
        break;
      }
    }
    if (!was_good){
      remaining = s.length-start;
      break;
    }
    cnt++;
  }
  print(cnt, remaining)
}

function main() {
    let T = +readline()[0];
    while (T--){
      let n = +readline()[0];
      let str = readline();
      calc(str)
    }
}


let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader();

function _main() {
  _inputLines = _inputData
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  /**
   * readNumber()        - int
   * readArray()         - generic space separated array
   * readBoolean()       - bool
   * readChar()          - char
   * readLine()          - string
   * readNumberArray()   - numeric array
   */

  /** Code Starts */

  const solve = () => {
    const [n, z] = inputReader.readNumberArray();
    const arr = inputReader.readNumberArray();
    let res = 0;

    for (let el of arr) res = Math.max(res, el | z);
    console.log(res);
  };

  let tc = inputReader.readNumber();
  for (let t = 0; t < tc; ++t) solve();

  /** Transliterate : cp-convert -s forces.js -d out.js */
}

var _inputData = "";
function cacheInput(data) {
  _inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on("data", cacheInput).on("end", _main);

function _inputReader() {
  function readNumber() {
    return Number(_inputLines[_lineNumber++]);
  }

  function readNumberArray() {
    return _inputLines[_lineNumber++].split(" ").map((val) => Number(val));
  }

  return {
    readNumber,
    readNumberArray,
  };
}

'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++) {
        let [n, z] = readline().split(' ').map(Number);
        let arr = readline().split(' ').map(Number);
        let max = -Infinity;
        for (let i = 0; i < arr.length; i++) {
            let r = arr[i] | z;
            if (r > max) {
                max = r;
            }
        }
        output(max);
    }
}

'use strict';

function solve(n, m, a) {
  let res = 0;
  for (let num of a) {
    res = Math.max(res, num | m);
  }
  return res;
}

async function main(read) {
  try {
    let t = Number(await read());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      const [n, m] = (await read()).split(' ').map(Number);
      const a = (await read()).split(' ').map(Number);
      res[i] = solve(n, m, a);
    }
    return res.join('\n');
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', async () => {
  inputs = str.split('\n').values();
  const output = await main(read);
  process.stdout.write(output);
});

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 = 10000000000;
for(var qe=1;qe<=T;qe++) {
  var [n,z] = readline().split(' ').map((x) => parseInt(x));
  var a = readline().split(' ').map((x) => parseInt(x));
  var ans = 0;

  for(var i=0;i<n;i++) {
    for(var j=0;j<n;j++) {
      if(j != i) {
        ans = max(ans, a[i]|(a[j]&z))
      } else {
        ans = max(ans, a[i]|z);
      }
    }
  }
  // console.log(mx, a)
  if(n == 1) ans = a[0]|z;
  console.log(ans);
}

let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader();

function _main() {
  _inputLines = _inputData
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  /**
   * readNumber()        - int
   * readArray()         - generic space separated array
   * readBoolean()       - bool
   * readChar()          - char
   * readLine()          - string
   * readNumberArray()   - numeric array
   */

  /** Code Starts */

  const solve = () => {
    const [n, z] = inputReader.readNumberArray();
    const arr = inputReader.readNumberArray();
    let res = 0;

    for (let el of arr) res = Math.max(res, el | res);
    console.log(res);
  };

  let tc = inputReader.readNumber();
  for (let t = 0; t < tc; ++t) solve();

  /** Transliterate : cp-convert -s forces.js -d out.js */
}

var _inputData = "";
function cacheInput(data) {
  _inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on("data", cacheInput).on("end", _main);

function _inputReader() {
  function readNumber() {
    return Number(_inputLines[_lineNumber++]);
  }

  function readNumberArray() {
    return _inputLines[_lineNumber++].split(" ").map((val) => Number(val));
  }

  return {
    readNumber,
    readNumberArray,
  };
}