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

function solve(n, grid) {
    for (let i = 0; i < 5; i++) {
        for (let j = i + 1; j < 5; j++) {
            if (check(n, grid, i, j)) return 'YES'
        }
    }
    return 'NO'
}
function check(n, grid, a, b) {
    let both = 0
    let ca = 0
    let cb = 0
    for (let i = 0; i < n; i++) {
        if (grid[i][a] && grid[i][b]) {
            both++
        } else if (grid[i][a]) {
            ca++
        } else if (grid[i][b]) {
            cb++
        } else {
            return false
        }
    }
    // console.log(both, ca, cb)
    return both + ca >= n / 2 && both + cb >= n / 2
}

const solve = (n,arr)=>{
     for(let i=0;i<5;i++){
          for(let j=0;j<5;j++){
               let cnt = 0,cnt1 = 0,cnt2 = 0;
               if(i!==j){
                    for(let k=0;k<n;k++){
                         if(arr[k][i]===1) cnt1++;
                         if(arr[k][j]===1) cnt2++;
                         if(arr[k][i]===0 && arr[k][j]===0) cnt=1;
                    }
                    if((cnt1>=n/2)&&(cnt2>=n/2)&&(cnt===0)) return "YES";
               }
          }
     }
     return "NO";
}
function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let n = parseInt(readline());
       let arr =  [];
       for(let i=0;i<n;i++){
            arr.push(readline().trim().split(" ").map(cur=>parseInt(cur)));
       }
       console.log(solve(n,arr));
  }
}
main();

// dist/FinalCode/Common/InputOutputClass.js
var Input = function() {
  function Input2(inputData) {
    var _this = this;
    this.SettleStream = function() {
      var re = /\s+/;
      _this.inputWords = _this.inputStream.split(re);
      _this.inputWordsLength = _this.inputWords.length;
    };
    this.getLength = function() {
      return _this.inputWordsLength;
    };
    this.getEveryWord = function() {
      return _this.inputWords;
    };
    this.getNextWord = function() {
      _this.inputWordsCount++;
      if (_this.inputWordsLength < _this.inputWordsCount) {
        return "";
      }
      return _this.inputWords[_this.inputWordsCount - 1];
    };
    this.getNextString = function() {
      return _this.getNextWord();
    };
    this.getNextBigInt = function() {
      return BigInt(_this.getNextWord());
    };
    this.getNextNumber = function() {
      return Number(_this.getNextWord());
    };
    this.getNextInt = function() {
      return parseInt(_this.getNextWord(), 10);
    };
    this.getNextFloat = function() {
      return parseFloat(_this.getNextWord());
    };
    this.inputWordsCount = 0;
    this.inputStream = inputData;
  }
  Input2.prototype.SetStream = function(chunk) {
    this.inputStream += chunk;
  };
  return Input2;
}();
var InputOutputClass_default = Input;
var writeLine = function(outputElement) {
  var _internalWrite = function(_internalOutputElement) {
    process.stdout.write(_internalOutputElement);
  };
  _internalWrite(String(outputElement) + "\n");
};

// dist/main.js
var rw = new InputOutputClass_default("");
process.stdin.resume();
process.stdin.setEncoding("utf-8");
process.stdin.on("data", function(chunk) {
  rw.SetStream(chunk);
});
process.stdin.on("end", function() {
  rw.SettleStream();
  mainFunc();
});
var mainFunc = function() {
  testCases();
};
var testCases = function() {
  var test = rw.getNextInt();
  for (var i = 0; i < test; i++) {
    solveCase();
  }
};
var createArray = function(initSize) {
  var result = new Array(initSize);
  for (var i = 0; i < initSize; i += 1) {
    result[i] = new Array();
  }
  return result;
};
var solveCase = function() {
  var num = rw.getNextInt();
  var week = createArray(num);
  for (var i = 0; i < num; i++) {
    for (var j = 0; j < 5; j++) {
      week[i].push(rw.getNextInt());
    }
  }
  for (var i = 0; i < 5; i++) {
    for (var j = i + 1; j < 5; j++) {
      var a = 0;
      var b = 0;
      var c = 0;
      for (var k = 0; k < num; k++) {
        if (week[k][i] === 1 && week[k][j] === 1) {
          c += 1;
          continue;
        }
        a += week[k][i];
        b += week[k][j];
      }
      if (a < num / 2 && c >= num / 2 - a) {
        c -= num / 2 - a;
        a = num / 2;
      }
      if (b < num / 2 && c >= num / 2 - b) {
        c -= num / 2 - b;
        b = num / 2;
      }
      if (a >= num / 2 && b >= num / 2) {
        writeLine("YES");
        return;
      }
    }
  }
  writeLine("NO");
};

//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 list = new Array(N);
		for(var i = 0; i < N; i++){
			list[i] = nextIntArray(5);
		}
		var isOK = false;
		for(var i = 0; i < 4; i++){
			for(var j = i + 1; j < 5; j++){
				var ato = 0;
				var L = 0;//i
				var R = 0;//j
				var isNG = false;
				for(var k = 0; k < N; k++){
					if(list[k][i] == 1 && list[k][j] == 1){
						ato++;
					}else if(list[k][i] == 1 && list[k][j] == 0){
						L++;
					}else if(list[k][i] == 0 && list[k][j] == 1){
						R++;
					}else{
						isNG = true;//no select
						break;
					}
				}
				if(!isNG){
					if(L <= (N / 2) && R <= (N / 2) && L + R + ato == N){
						isOK = true;
					}
				}
			}
		}
		myout((isOK) ? "YES" : "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 avl = [];
		for (let i = 0; i < n; i++)
			avl[i] = rna();

		let ans;
		for (let i = 0; i < 5; i++) {
			for (let j = i + 1; j < 5; j++) {
				let cnt1 = 0, cnt2 = 0, ok = true;
				for (let k = 0; ok && k < n; k++) {
					cnt1 += avl[k][i];
					cnt2 += avl[k][j];

					ok = avl[k][i] || avl[k][j];
				}
				ans = ans || ok && n%2==0 && cnt1 >= n/2 && cnt2 >= n/2;
			}
		}

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

const solve = (n,arr1)=>{
     let arr = [];
     for(let i=0;i<n;i++){
          let flag = 0;
          for(let j=0;j<5;j++){
               if(arr1[i][j]===1){
                    flag = 1;
                    break;
               }
          }
          if(flag) arr.push(arr1[i]);
     }
     if(arr.length%2===1) return "NO";
     n = arr.length;
     let d = {};
     for(let i=0;i<5;i++){
          let t=[];
          for(let j=0;j<n;j++){
               if(arr[j][i]===1) t.push(j+1);
          }
          if(t.length>=n/2) d[i+1] = t;
     }
     let t = Object.keys(d);
     if(t.length<2) return "NO";
     let r = new Set();
     for(let i=0;i<t.length;i++){
          let k = d[t[i]];
          for(let j=0;j<k.length;j++) r.add(k[j]);
     }
     let cnt = 0;
     for(let i=1;i<=n;i++) if(r.has(i)===true) cnt++;
     if(cnt%2===0) return "YES";
     else return "NO";

}
function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let n = parseInt(readline());
       let arr =  [];
       for(let i=0;i<n;i++){
            arr.push(readline().trim().split(" ").map(cur=>parseInt(cur)));
       }
       console.log(solve(n,arr));
  }
}
main();

const solve = (n,arr)=>{
     let d = {};
     for(let i=0;i<5;i++){
          let t=[];
          for(let j=0;j<n;j++){
               if(arr[j][i]===1) t.push(j+1);
          }
          if(t.length>=n/2) d[i+1] = (t);
     }
     let t = Object.keys(d);
     if(t.length<2) return "NO";
     let r = new Set();
     for(let i=0;i<t.length;i++){
          let k = d[t[i]];
          for(let j=0;j<k.length;j++) r.add(k[j]);
     }
     for(let i=1;i<=n;i++) if(r.has(i)===false) return "NO";
     return "YES";

}
function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let n = parseInt(readline());
       let arr =  [];
       for(let i=0;i<n;i++){
            arr.push(readline().trim().split(" ").map(cur=>parseInt(cur)));
       }
       console.log(solve(n,arr));
  }
}
main();

const solve = (n,arr)=>{
     let d = {};
     for(let i=0;i<5;i++){
          let t=[];
          for(let j=0;j<n;j++){
               if(arr[j][i]===1) t.push(j+1);
          }
          if(t.length>=n/2) d[i+1] = (t);
     }
     let t = Object.keys(d);
     if(t.length<2) return "NO";
     let r = new Set();
     for(let i=0;i<t.length;i++){
          let k = d[t[i]];
          for(let i=0;i<k.length;i++) r.add(k[i]);
     }
     for(let i=1;i<=n;i++) if(r.has(i)===false) return "NO";
     return "YES";

}
function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let n = parseInt(readline());
       let arr =  [];
       for(let i=0;i<n;i++){
            arr.push(readline().trim().split(" ").map(cur=>parseInt(cur)));
       }
       console.log(solve(n,arr));
  }
}
main();

const solve = (n,arr)=>{
     let d = {};
     for(let i=0;i<5;i++){
          let t=[];
          for(let j=0;j<n;j++){
               if(arr[j][i]===1) t.push(j+1);
          }
          if(t.length>=n/2) d[i+1] = (t);
     }
     let t = Object.keys(d);
     if(t.length<2) return "NO";
     let r = new Set();
     for(let i=0;i<t.length;i++){
          let k = d[t[i]];
          for(let i=0;i<n;i++) r.add(k[i]);
     }
     for(let i=1;i<=n;i++) if(r.has(i)===false) return "NO";
     return "YES";

}
function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let n = parseInt(readline());
       let arr =  [];
       for(let i=0;i<n;i++){
            arr.push(readline().trim().split(" ").map(cur=>parseInt(cur)));
       }
       console.log(solve(n,arr));
  }
}
main();

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 avl = [];
		for (let i = 0; i < n; i++)
			avl[i] = rna();

		let ans;
		for (let i = 0; i < 5; i++) {
			for (let j = i + 1; j < 5; j++) {
				let cnt1 = 0, cnt2 = 0, ok = true;
				for (let k = 0; k < n; k++) {
					cnt1 += avl[k][i];
					cnt2 += avl[k][j];

					ok = ok && !avl[k][i] && !avl[k][j];
				}
				ans = ans || ok && n%2==0 && cnt1 >= n/2 && cnt2 >= n/2;
			}
		}

		console.log(ans ? 'YES' : '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 avl = [];
		for (let i = 0; i < n; i++)
			avl[i] = rna();

		let ans;
		for (let i = 0; i < 5; i++) {
			for (let j = i + 1; j < 5; j++) {
				let cnt1 = 0, cnt2 = 0, ok = true;
				for (let k = 0; k < n; k++) {
					if (avl[k][i])
						cnt1++;
					else if (avl[k][j])
						cnt2++;
					else
						ok = false;
				}
				ans = ans || (ok && n%2==0 && cnt1 >= n/2 && cnt2 >= n/2);
			}
		}

		console.log(ans ? 'YES' : '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 avl = [];
		for (let i = 0; i < n; i++)
			avl[i] = rna();

		let ans;
		for (let i = 0; i < 5; i++) {
			for (let j = i + 1; j < 5; j++) {
				let cnt1 = 0, cnt2 = 0, ok = true;
				for (let k = 0; k < n; k++) {
					if (avl[k][i])
						cnt1++;
					else if (avl[k][j])
						cnt2++;
					else
						ok = false;
				}
				ans = ans || ok && n%2==0 && cnt1 >= n/2 && cnt2 >= n/2;
			}
		}

		console.log(ans ? 'YES' : '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 avl = [];
		for (let i = 0; i < n; i++)
			avl[i] = rna();

		let ans;
		for (let i = 0; i < 5; i++) {
			for (let j = i + 1; j < 5; j++) {
				let cnt1 = 0, cnt2 = 0;
				for (let k = 0; k < n; k++) {
					if (avl[k][i])
						cnt1++;
					if (avl[k][j])
						cnt2++;
				}
				ans = ans || n%2==0 && cnt1 >= n/2 && cnt2 >= n/2;
			}
		}

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

// dist/FinalCode/Common/InputOutputClass.js
var Input = function() {
  function Input2(inputData) {
    var _this = this;
    this.SettleStream = function() {
      var re = /\s+/;
      _this.inputWords = _this.inputStream.split(re);
      _this.inputWordsLength = _this.inputWords.length;
    };
    this.getLength = function() {
      return _this.inputWordsLength;
    };
    this.getEveryWord = function() {
      return _this.inputWords;
    };
    this.getNextWord = function() {
      _this.inputWordsCount++;
      if (_this.inputWordsLength < _this.inputWordsCount) {
        return "";
      }
      return _this.inputWords[_this.inputWordsCount - 1];
    };
    this.getNextString = function() {
      return _this.getNextWord();
    };
    this.getNextBigInt = function() {
      return BigInt(_this.getNextWord());
    };
    this.getNextNumber = function() {
      return Number(_this.getNextWord());
    };
    this.getNextInt = function() {
      return parseInt(_this.getNextWord(), 10);
    };
    this.getNextFloat = function() {
      return parseFloat(_this.getNextWord());
    };
    this.inputWordsCount = 0;
    this.inputStream = inputData;
  }
  Input2.prototype.SetStream = function(chunk) {
    this.inputStream += chunk;
  };
  return Input2;
}();
var InputOutputClass_default = Input;
var writeLine = function(outputElement) {
  var _internalWrite = function(_internalOutputElement) {
    process.stdout.write(_internalOutputElement);
  };
  _internalWrite(String(outputElement) + "\n");
};

// dist/main.js
var rw = new InputOutputClass_default("");
process.stdin.resume();
process.stdin.setEncoding("utf-8");
process.stdin.on("data", function(chunk) {
  rw.SetStream(chunk);
});
process.stdin.on("end", function() {
  rw.SettleStream();
  mainFunc();
});
var mainFunc = function() {
  testCases();
};
var testCases = function() {
  var test = rw.getNextInt();
  for (var i = 0; i < test; i++) {
    solveCase();
  }
};
var createArray = function(initSize) {
  var result = new Array(initSize);
  for (var i = 0; i < initSize; i += 1) {
    result[i] = new Array();
  }
  return result;
};
var solveCase = function() {
  var num = rw.getNextInt();
  var week = createArray(num);
  for (var i = 0; i < num; i++) {
    for (var j = 0; j < 5; j++) {
      week[i].push(rw.getNextInt());
    }
  }
  for (var i = 0; i < 5; i++) {
    for (var j = i + 1; j < 5; j++) {
      var a = 0;
      var b = 0;
      var c = 0;
      for (var k = 0; k < num; k++) {
        if (week[k][i] === 1 && week[k][j] === 1) {
          c += 1;
        }
        a += week[k][i];
        b += week[k][j];
      }
      a -= c;
      b -= c;
      if (a < num / 2 && c > 0) {
        c -= num / 2 - a;
        a = num / 2;
      }
      if (b < num / 2 && c > 0) {
        c -= num / 2 - b;
        b = num / 2;
      }
      if (a >= num / 2 && b >= num / 2) {
        writeLine("YES");
        return;
      }
    }
  }
  writeLine("NO");
};


function getInt( num ) {
    return parseInt( num, 10 );
}

var t = parseInt( readline(), 10 );

for ( var i = 0; i < t; i++ ) {
    var line1 = readline().split( ' ' ).map( getInt );
    var line2 = readline();
    var sol = solution(line1[1], line2)
    print( sol );
}
function solution( k, s) {
    s = s.split('');
    var last = s.lastIndexOf('*');
    var first = s.indexOf('*');
    s[first] = 'x';
    s[last] = 'x';

    var prevprev = first;
    var prev;
    var curr;
    for(var i = first + 1; i <= last; i++){
        if(s[i]==='*' || s[i]==='x'){
            s[i] = 'x';
            curr = i;
            if(prev === undefined){
                prev = curr;
                continue;
            }
            if(curr - prevprev <= k){
                s[prev] = '*';
                prev = undefined;
            }
            prevprev = prev || prevprev;
            prev = curr;
        }
    }
    var res = s.filter(function(char){
        return char === 'x';
    }).length;

return res;
}

l=readline;
for (T=+l(); T--; ) {
    I = l().split` `.map(Number);
    n = I[0];
    k = I[1];
    S = l();

    c = d = p = 0;
    first = last = false;
    for(i=0; i < S.length; i++) {
        d++;
        if (S[i] == '*') {
            if (!first) {
                first = true;
                last = true;
                c++;
                d = 0;
            } else if (d > k && p > 0) {
                i = p;
                last = true;
                p = d = 0;
                c++;
            } else {
                last = false;
                p = i;
            }
        }
    }
    if (!last) {
        c++;
    }

    print(c)
}

t=+readline()
while(t--){r=readline().split` `
n=+r[0]
k=+r[1]
s=readline()
f=s.indexOf('*')
l=s.lastIndexOf('*')
a=1
j=f
while(true){j=Math.min(j+k,n-1)
for(i=j;i>f;i--){if(s[i]=='*'){f=i
a++;break}}j=f
if(f>=l){break;}}print(a)}

"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, k] = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    let arr = readline().trim().split("");
    if (n === 1) {
      console.log(1);
      continue;
    }
    let start = arr.indexOf("*");
    let cnt = 1;
    while (true) {
      let j = Math.min(n - 1, start + k);
      for (; start < j && arr[j] === "."; j--);
      if (start === j) break;
      cnt++;
      start = j;
    }
    console.log(cnt);
  }
};
solve();

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

// Make a Snippet for the code above this and then write your logic in main();
var mod = 998244353n
var maxN = 10e6 + 1

function main() {
  var x = parseInt(readline())
  //
  Array(parseInt(x)).fill(1).map((t, iii) => {
    // var n = parseInt(readline())
    //   var a = new Array(n)
    //   var marked = new Array(n).fill(false)
    //   var found = new Array(n).fill(false)
    var [n, kk] = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    });
    var a = readline().split('').map((x, iii) => {
      return x
    });

    var next
    for (let i = 0; i < n; i++) {
      if (a[i] === '*') {
        next = i
        break
      }
    }
    var res = 1
    var j = 0
    a[next] === 'X'
    for (let i = 0; i < a.length; i++) {
      j = next
      for (let k = j; k <= j + kk; k++) {
        if (k < a.length && a[k] === '*') next = k
      }
      if (j !== next) {
        a[next] = 'X'
        res++
      }
    }
    console.log(res)

  })
}

var timer = 0;
function dfs(v, prev) {
   var h = {};
   v.__h = h;
   h.tin = ++timer;
   h.up = [];
   var i = 0;
   var next = prev;
   while (next) {
      h.up[i] = next;
      next = next.__h.up[i++];
   }
   var children = v.childNodes;
   for (i = 0; i < children.length; i++) {
      dfs(children[i], v);
   }
   h.tout = ++timer;
}

function solve() {
   var nk = read().split(' ').map(Number);
   var n = nk[0];
   var k = nk[1];
   var str = read();
   var starIndexes = [];
   var lastStarIndex;
   for (var i = 0; i < n; i++) {
      if (str[i] === '*') {
         starIndexes.push(i);
         lastStarIndex = i;
      }
   }
   var firstStarIndex = starIndexes[0];
   var c1 = 1;
   var i = firstStarIndex;
   while (i !== lastStarIndex) {
      i += k;
      while (starIndexes.indexOf(i) === -1) {
         i--;
      }
      c1++;
   }
   var c2 = 1;
   var i = lastStarIndex;
   while (i !== firstStarIndex) {
      i -= k;
      while (starIndexes.indexOf(i) === -1) {
         i++;
      }
      c2++;
   }
   write(Math.min(c1, c2));
}

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

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

function readArray(f) {
   return read().split(' ').map(f);
}

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

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let input = [];
rl.on('line', line => {
    input.push(line);
})
rl.on('close', line => {
    let l = Number(input[0]);
    let j = 1;
    for (let i = 0; i < l; i++) {
        var [n, k] = input[j].split(" ").map((i) => {
            return Number(i);
        });
        j++;
        var str = input[j];
        j++;
        function minReplace(n, k, str) {
            var i;
            for (i = 0; i < n; i++) {
                if (str[i] === '*') {
                    break;
                }
            }
            var firstIndex = i;
            for (i = n - 1; i >= 0; i--) {
                if (str[i] === '*') {
                    break;
                }
            }
            var lastIndex = i;
            if (firstIndex === lastIndex) {
                return 1;
            }
            if (firstIndex + k >= lastIndex) {
                return 2;
            }
            var count = 2;
            i = firstIndex;
            while (i + k < lastIndex) {
                var j = i + k;
                while (str[j] !== '*') {
                    j--;
                }
                count++;
                i = j;
            }
            return count;
        }
        console.log(minReplace(n, k, str));
    }
})

//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{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
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();
	for(var i = 0; i < t; i++){
		var N = nextInt();
		var K = nextInt();
		var s = nextCharArray();
		var output = 0;
		var L = -1;
		var R = -1;
		for(var j = 0; j < N; j++){
			if(s[j] == "*"){
				s[j] = "x";
				output++;
				L = j;
				break;
			}
		}
		for(var j = N - 1; j >= 0; j--){
			if(s[j] == "*"){
				s[j] = "x";
				output++;
				R = j;
				break;
			}
		}
		if(L == -1 || R == -1){
			myout(output);
			continue;
		}
		var Ls = makeClone(s);
		var Rs = makeClone(s);
		var countL = output;
		var countR = output;
		for(var j = L; j < N; j++){
			if(Ls[j] == "x"){
				if(j + K < R){
					for(var k = j + K; k > j; k--){
						if(Ls[k] == "*"){
							Ls[k] = "x";
							countL++;
							break;
						}
					}
				}

			}
		}
		for(var j = R; j >= 0; j--){
			if(Rs[j] == "x"){
				if(j - K > L){
					for(var k = j - K; k < j; k++){
						if(Rs[k] == "*"){
							Rs[k] = "x";
							countR++;
							break;
						}
					}
				}
			}
		}
		//myerr({Rs, Ls});
		myout(Math.min(countR, countL));
	}
}

///////////////////////////////// pre-define /////////////////////////////////////
const pr = console.log;
///////////////////////////////////////////////////////////////////////////////////

const solve = (n, k, s) => {
    let star = [];
    for (let i = 0; i < n; i++) {
        if (s[i] == '*') star.push(i);
    }
    let len = star.length;
    let res = 1;
    for (let i = 0; i != len - 1;) {
        let j;
        for (j = i + 1; j < len; j++) {
            if (star[j] - star[i] > k) break;
        }
        res++;
        j--;
        i = j;
    }
    pr(res);
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line);
    });
    rl.on('close', () => {
        let t = Number(input[0]);
        let i = 1;
        while (t--) {
            let tmp = input[i].split(" ").map(Number);
            solve(tmp[0], tmp[1], input[i + 1]);
            i += 2;
        }
    });
};

main()

"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, k] = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    let arr = readline().trim().split("");
    if (n === 1) {
      console.log(1);
      continue;
    }
    let start = arr.indexOf("*"),
      end = arr.lastIndexOf("*");
    if (end - start + 1 <= 2) {
      console.log(end - start + 1);
      continue;
    }
    let i = start,
      cnt = 0;
    while (i <= end) {
      while (i <= end) {
        if (arr[i] === "*" && arr[i + k] === "*") {
          cnt += 2;
          arr[i] = "X";
          arr[i + k] = "X";
          i = i + k + 1;
          break;
        }
        if (i === start) cnt++;
        i++;
      }
    }
    if (arr[end] === "*") cnt++;
    console.log(cnt);
  }
};
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, k] = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    let arr = readline().trim().split("");
    if (n === 1) {
      console.log(1);
      continue;
    }
    let cnt = 0,
      i;
    for (i = 0; i < n; i++) {
      if (arr[i] === "*") {
        arr[i] === "X";
        cnt++;
        if (i + k < n && arr[i + k] === "*") {
          arr[i + k] = "X";
          cnt++;
          i = i + k;
        }
        break;
      }
    }
    for (let j = i + 1; j < n; j++) {
      if (j + k < n && arr[j] === "*" && arr[j + k] === "*") {
        arr[j] = "X";
        arr[j + k] = "X";
        cnt += 2;
      }
    }
    if (arr[n - 1] === "*") cnt++;
    console.log(cnt);
  }
};
solve();

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

// Make a Snippet for the code above this and then write your logic in main();
var mod = 998244353n
var maxN = 10e6 + 1

function main() {
  var x = parseInt(readline())
  //
  Array(parseInt(x)).fill(1).map((t, iii) => {
    // var n = parseInt(readline())
    //   var a = new Array(n)
    //   var marked = new Array(n).fill(false)
    //   var found = new Array(n).fill(false)
    var [n, kk] = readline().split(' ').map((x, iii) => {
      return BigInt(x)
    });
    var a = readline().split('').map((x, iii) => {
      return x
    });
    var min = Number.MAX_SAFE_INTEGER

    var copy = a.slice()

    var index1
    var prev
    for (let i = 0; i < n; i++) {
      if (copy[i] === '*') {
        copy[i] = 'x'
        index1 = i
        break
      }
    }
    for (let i = n; i >= 0; i--) {
      if (copy[i] === '*') {
        copy[i] = 'x'
        break
      }
    }

    var count = index1
    for (let i = 0; i < n; i++) {
      index1 = count
      prev = index1
      while (index1 < copy.length && Math.abs(index1 - prev) <= kk) {
        if (copy[index1] === '*') {
          count = index1
        }
        index1++
      }
      copy[count] = 'x'
    }

    var sum = 0
    for (let i = 0; i < copy.length; i++) {
      if (copy[i] === 'x') sum++
    }
    min = Math.min(min, sum)

    //second part

    copy = a.slice()
    for (let i = 0; i < n; i++) {
      if (copy[i] === '*') {
        copy[i] = 'x'
        break
      }
    }
    for (let i = n; i >= 0; i--) {
      if (copy[i] === '*') {
        copy[i] = 'x'
        index1 = i
        break
      }
    }
    for (let i = 0; i < n; i++) {
      index1 = count
      prev = index1
      while (index1 >= 0 && Math.abs(index1 - prev) <= kk) {
        if (copy[index1] === '*') {
          count = index1
        }
        index1--
      }
      if (Math.abs(index1 - prev) > kk) copy[count] = 'x'
    }

    var sum = 0
    for (let i = 0; i < copy.length; i++) {
      if (copy[i] === 'x') sum++
    }
    min = Math.min(min, sum)

    console.log(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++];
}

// Make a Snippet for the code above this and then write your logic in main();
var mod = 998244353n
var maxN = 10e6 + 1

function main() {
  var x = parseInt(readline())
  //
  Array(parseInt(x)).fill(1).map((t, iii) => {
    // var n = parseInt(readline())
    //   var a = new Array(n)
    //   var marked = new Array(n).fill(false)
    //   var found = new Array(n).fill(false)
    var [n, kk] = readline().split(' ').map((x, iii) => {
      return BigInt(x)
    });
    var a = readline().split('').map((x, iii) => {
      return x
    });
    var min = Number.MAX_SAFE_INTEGER

    for (let k = 0; k < a.length; k++) {
      var copy = a.slice()
      var index = 0
      for (let i = 0; i < n; i++) {
        if (copy[i] === '*' && i === k) {
          copy[i] = 'x'
          index = i
        }
      }
      var index1
      var count = index
      var prev = index
      for (let i = 0; i < n; i++) {
        index1 = count
        prev = index1
        while (index1 < copy.length && Math.abs(index1 - prev) <= kk) {
          if (copy[index1] === '*') {
            count = index1
          }
          index1++
        }
        copy[count] = 'x'
      }
      var index1
      var count = index
      for (let i = 0; i < n; i++) {
        index1 = count
        prev = index1
        while (index1 >=0 && Math.abs(index1 - prev) <= kk) {
          if (copy[index1] === '*') {
            count = index1
          }
          index1--
        }
        copy[count] = 'x'
      }

      // console.log(copy.join(''))
      var sum =0
      for (let i = 0; i <copy.length; i++) {
        if(copy[i] ==='x') sum++
      }
      min = Math.min(min, sum)
    }

    console.log(min)
  })
}

l=readline;
for (T=+l(); T--; ) {
    I = l().split` `.map(Number);
    n = I[0];
    k = I[1];
    S = [...l()];

    c = d = p = 0;
    first = last = false;
    for(i=0; i < S.length; i++) {
        const s = S[i];
        d++;
        if (s == '*') {
            if (!first) {
                first = true;
                last = true;
                S[i] = 'x';
                c++;
                d = 0;
            } else if (d > k && p > 0) {
                S[p] = 'x';
                i = p;
                last = true;
                p = d = 0;
                c++;
            } else {
                last = false;
                p = i;
            }
        }
    }
    if (!last) {
        S[p] = 'x';
        c++;
    }

    print(c)
}


function solve() {
   var nx = readArray(BigInt);
   var a = readArray(BigInt);
   a.sort(sortF);
   var n = nx[0];
   var x = nx[1];
   var ans = 0;
   var r = n;
   for (var i = n - 1n; i >= 0n; i--) {
      if (a[i] * (r - i) >= x) {
         ans++;
         r = i;
      }
   }
   write(ans);
}
function init() {
   var T;
   T = 1;
   T = Number(read());
   for (var t = 0; t < T; t++) {
      solve();
   }
}

function readArray(mapF) {
   return read().split(' ').map(mapF);
}

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

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

      RL.on('line', (line) => {
         MEMORY.push(line);
      });

      RL.on('close', init);
   }
} else {
   init();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}

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

    C();
});

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

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function A(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());
        if(n % 2 === 0){
            console.log('YES');
        }else{
            console.log('NO');
        }
    }
}

function C(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let [n,x] = ti(readline().split(' '));
        let a = ti(readline().split(' '));
        let max = 0;
        let dp = new Array(n);
        a.sort((a,b) => a-b)
        for(let i = n-1; i >= 0; i--){
            let m = Math.ceil(x / a[i]);

            if(i+m < n){
                dp[i] = 1 + dp[i+m];
            }else{
                if(i+m-1 < n){
                    dp[i] = 1;
                }else{
                    dp[i] = 0;
                }
            }

            max = Math.max(max, dp[i]);
        }

        //console.log(dp);
        console.log(max);
    }
}

var case_num = parseInt(readline());
for (var i = 0; i < case_num; i += 1) {
  var tmp = readline().split(' ').map((e) => parseInt(e));
  var n = tmp[0], x = tmp[1];
  var nums = readline().split(' ').map((e) => parseInt(e));
  nums.sort((e1, e2) => e1 - e2);
  var cnt = 0, p = n - 1, prev = n;
  while (p >= 0) {
    if ((prev - p) * nums[p] >= x) {
      prev = p;
      cnt += 1;
    }
    p -= 1;
  }
  print(cnt);
}

const case_num = parseInt(readline());
for (var i = 0; i < case_num; i += 1) {
  const tmp = readline().split(' ').map((e) => parseInt(e));
  const n = tmp[0], x = tmp[1];
  const nums = readline().split(' ').map((e) => parseInt(e));
  nums.sort((e1, e2) => e1 - e2);
  var cnt = 0, p = n - 1, prev = n;
  while (p >= 0) {
    if ((prev - p) * nums[p] >= x) {
      prev = p;
      cnt += 1;
    }
    p -= 1;
  }
  print(cnt);
}


var n = +readline();

var mid = Math.floor(Math.pow(n, 0.5))

var low = 0, high = 0;

for(var i = mid; i >= 5; i--) {
    if(n % i === 0) {
        low = i
        high = n / i
    }
}

if(!low) {
    print(-1)
} else {
    // TODO
    var str='aeiou'
    var res =''

    for(var i=0; i< low; i++) {
        for( var j = 0; j< high; j++) {
            res += str[(i+j) % 5]
        }
    }
    print(res)
}

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var word = [
        'aeiou',
        'eioua',
        'iouae',
        'ouaei',
        'uaeio',
    ]

    var a = read.number();
    var n = false;
    if(a < 25) {
        print(-1);
        return;
    }

    for(var i = 5; i < a; i++) {
        if(a%i === 0 && a/i >= 5) {
            n = i
            break;
        }
    }

    if(!n) {
        print(-1);
        return;
    }
    else {
        var m = a / n;
        var res = '';
        for(var i =0 ;i < n; i++) {
            res+= word[i % 5];
            for(var j = 5; j < m; j++) {
                res += word[i%5][(j - 5)%5];
            }
        }
        print(res);
    }
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var word = [
        'aeiou',
        'eioua',
        'iouae',
        'ouaei',
        'uaeio',
    ]

    var a = read.number();
    var n = false;
    if(a < 25) {
        print(-1);
    }

    for(var i = 5; i < a; i++) {
        if(a%i === 0 && a/i >= 5) {
            n = i
            break;
        }
    }

    if(!n) {
        print(-1);
    }
    else {
        var m = a / n;
        var res = '';
        for(var i =0 ;i < n;i++) {
            res+= word[i % 5];
            for(var j = 5; j < m; j++) {
                res += word[i%5][j - 5];
            }
            res+='\n';
        }
        print(res);
    }
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var word = [
        'aeiou',
        'eioua',
        'iouae',
        'ouaei',
        'uaeio',
    ]

    var a = read.number();
    var n = false;
    if(a < 25) {
        print(-1);
        return;
    }

    for(var i = 5; i < a; i++) {
        if(a%i === 0 && a/i >= 5) {
            n = i
            break;
        }
    }

    if(!n) {
        print(-1);
        return;
    }
    else {
        var m = a / n;
        var res = '';
        for(var i =0 ;i < n;i++) {
            res+= word[i % 5];
            for(var j = 5; j < m; j++) {
                res += word[i%5][j - 5];
            }
        }
        print(res);
    }
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var word = [
        'aeiou',
        'eioua',
        'iouae',
        'ouaei',
        'uaeio',
    ]

    var a = read.number();
    var n = false;
    if(a < 25) {
        print(-1);
        return;
    }

    for(var i = 5; i < a; i++) {
        if(a%i === 0 && a/i >= 5) {
            n = i
            break;
        }
    }

    if(!n) {
        print(-1);
        return;
    }
    else {
        var m = a / n;
        var res = '';
        for(var i =0 ;i < n;i++) {
            res+= word[i % 5];
            for(var j = 5; j < m; j++) {
                res += word[i%5][j - 5];
            }
            res+='\n';
        }
        print(res);
    }
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var a = read.number();
    var n = false;
    for(var i = 2; i < a; i++) {
        if(a%i === 0) {
            n = i
            break;
        }
    }

    if(!n) {
        print(-1);
    }
    else {
        var res = '';
        for(var i =0;i < a;i++) {
            res+='a';
        }
        print(res);
    }

}());


arr=readline().split(" ").map(x=>x*1);
n=arr[0];
m=arr[1];
grid = [];
for(i=0; i<n; i++) grid.push(readline());
allH = true;
allV = true;
for(i=0; i<n; i++){
    for(j=1; j<m; j++){
        if(grid[i][j]!=grid[i][0]){
            allH = false;
            break;
        }
    }
    if(!allH) break;
}
for(i=0; i<m; i++){
    for(j=1; j<n; j++){
        if(grid[j][i]!=grid[0][i]){
            allV = false;
            break;
        }
    }
    if(!allV) break;
}
isH = false;
isV = false;
if(allH){
    isH = true;
    colors=[];
    hist=[];
    for(i=0; i<n; i++){
        ind = colors.indexOf(grid[i][0]);
        if(ind!=colors.length-1 && ind!=-1){
            isH = false;
            break;
        }else if(ind==-1){
            colors.push(grid[i][0]);
            hist.push(1);
        }else{
            hist[ind]++;
        }
    }
    if(colors.length!=3){
        isH = false;
    }
    for(i=1; i<3; i++){
        if(hist[i]!=hist[i-1]) isH = false;
    }
}
if(allV){
    isV = true;
    colors=[];
    hist=[];
    for(i=0; i<m; i++){
        ind = colors.indexOf(grid[0][i]);
        if(ind!=colors.length-1 && ind!=-1){
            isV = false;
            break;
        }else if(ind==-1){
            colors.push(grid[0][i]);
            hist.push(1);
        }else{
            hist[ind]++;
        }
    }
    if(colors.length!=3){
        isV = false;
    }
    for(i=1; i<3; i++){
        if(hist[i]!=hist[i-1]) isV = false;
    }
}

if(isH || isV) print("YES");
else print("NO");

var n = readline();

n = n.split(" ");
var m = n[1];
n = n[0];
var flag = true;
var s = [];
for (var i = 0; i < n; i++) {
    s.push(readline());
}
if ((n * m % 3) !== 0) { flag = false; } else {
    if (n % 3 === 0) {
        var width = n / 3;
        var tmpl = s[0][0] + s[width][0] + s[width * 2][0];
        if ((tmpl[0] === tmpl[1]) || (tmpl[0] === tmpl[2]) || (tmpl[2] === tmpl[1])) { flag = false; }
        if (((tmpl.indexOf("R") + 1) * (tmpl.indexOf("G") + 1) * (tmpl.indexOf("B") + 1)) === 0) {
            flag = false;
        }

        for (var i = 0; i < width; i++) {
            for (var j = 0; j < m; j++) {
                if (tmpl !== s[i][j] + s[width + i][j] + s[width * 2 + i][j]) {
                    flag = false;
                }

            }
        }
    } else { flag = false; }
    if ((m % 3 === 0) && (!flag)) {
        flag = true;
        width = m / 3;
        tmpl = s[0][0] + s[0][width] + s[0][width * 2];
        if ((tmpl[0] === tmpl[1]) || (tmpl[0] === tmpl[2]) || (tmpl[2] === tmpl[1])) { flag = false; }
        if (((tmpl.indexOf("R") + 1) * (tmpl.indexOf("G") + 1) * (tmpl.indexOf("B") + 1)) === 0) {
            flag = false;
        }
        for (var i = 0; i < width; i++) {
            for (var j = 0; j < n; j++) {
                if (tmpl !== s[j][i] + s[j][width + i] + s[j][width * 2 + i]) {
                    flag = false;
                }
            }
        }
    }

}
if (flag) {
    print("YES")
} else {
    print("NO")
}

arr=readline().split(" ").map(x=>x*1);
n=arr[0];
m=arr[1];
grid = [];
for(i=0; i<n; i++) grid.push(readline());
allH = true;
allV = true;
for(i=0; i<n; i++){
    for(j=1; j<m; j++){
        if(grid[i][j]!=grid[i][0]){
            allH = false;
            break;
        }
    }
    if(!allH) break;
}
for(i=0; i<m; i++){
    for(j=1; j<n; j++){
        if(grid[j][i]!=grid[0][i]){
            allV = false;
            break;
        }
    }
    if(!allV) break;
}
isH = false;
isV = false;
if(allH){
    isH = true;
    colors=[];
    hist=[];
    for(i=0; i<n; i++){
        ind = colors.indexOf(grid[i][0]);
        if(ind!=colors.length-1 && ind!=-1){
            isH = false;
            break;
        }else if(ind==-1){
            colors.push(grid[i][0]);
            hist.push(1);
        }else{
            hist[ind]++;
        }
    }
    if(colors.length!=3){
        isH = false;
    }
    for(i=1; i<3; i++){
        if(hist[i]!=hist[i-1]) isH = false;
    }
}
if(allH){
    isV = true;
    colors=[];
    hist=[];
    for(i=0; i<m; i++){
        ind = colors.indexOf(grid[0][i]);
        if(ind!=colors.length-1 && ind!=-1){
            isV = false;
            break;
        }else if(ind==-1){
            colors.push(grid[0][i]);
            hist.push(1);
        }else{
            hist[ind]++;
        }
    }
    if(colors.length!=3){
        isV = false;
    }
    for(i=1; i<3; i++){
        if(hist[i]!=hist[i-1]) isV = false;
    }
}

if(isH || isV) print("YES");
else print("NO");

arr=readline().split(" ").map(x=>x*1);
n=arr[0];
m=arr[1];
grid = [];
for(i=0; i<n; i++) grid.push(readline());
allH = true;
allV = true;
for(i=0; i<n; i++){
    for(j=1; j<m; j++){
        if(grid[i][j]!=grid[i][0]){
            allH = false;
            break;
        }
    }
    if(!allH) break;
}
for(i=0; i<m; i++){
    for(j=1; j<n; j++){
        if(grid[j][i]!=grid[0][i]){
            allV = false;
            break;
        }
    }
    if(!allV) break;
}
isH = false;
isV = false;
if(allH){
    isH = true;
    colors=[];
    for(i=0; i<n; i++){
        ind = colors.indexOf(grid[i][0]);
        if(ind!=colors.length-1 && ind!=-1){
            isH = false;
            break;
        }else if(ind==-1){
            colors.push(grid[i][0]);
        }
    }
}
if(allV){
    isV = true;
    colors=[];
    for(i=0; i<m; i++){
        ind = colors.indexOf(grid[0][i]);
        if(ind!=colors.length-1 && ind!=-1){
            isV = false;
            break;
        }else if(ind==-1){
            colors.push(grid[0][i]);
        }
    }
}

if(isH || isV) print("YES");
else print("NO");

var n = readline();

n = n.split(" ");
var m = n[1];
n = n[0];
var flag = true;
var s = [];
for (var i = 0; i < n; i++) {
    s.push(readline());
}
if ((n * m % 3) !== 0) { flag = false; } else {
    if (n % 3 === 0) {
        var width = n / 3;
        var tmpl = s[0][0] + s[width][0] + s[width * 2][0];
        if ((tmpl[0] === tmpl[1]) || (tmpl[0] === tmpl[2]) || (tmpl[2] === tmpl[1])) { flag = false; }
        if (((tmpl.indexOf("R") + 1) * (tmpl.indexOf("G") + 1) * (tmpl.indexOf("B") + 1)) === 0) {
            flag = false;
        }

        for (var i = 0; i < width; i++) {
            for (var j = 0; j < m; j++) {
                if (tmpl !== s[i][j] + s[width + i][j] + s[width * 2 + i][j]) {
                    flag = false;
                }

            }
        }
    }
    if ((m % 3 === 0) && (!flag)) {
        width = m / 3;
        tmpl = s[0][0] + s[0][width] + s[0][width * 2];
        if ((tmpl[0] === tmpl[1]) || (tmpl[0] === tmpl[2]) || (tmpl[2] === tmpl[1])) { flag = false; }
        if (((tmpl.indexOf("R") + 1) * (tmpl.indexOf("G") + 1) * (tmpl.indexOf("B") + 1)) === 0) {
            flag = false;
        }
        for (var i = 0; i < width; i++) {
            for (var j = 0; j < n; j++) {
                if (tmpl !== s[j][i] + s[j][width + i] + s[j][width * 2 + i]) {
                    flag = false;
                }
            }
        }
    }

}
if (flag) {
    print("YES")
} else {
    print("NO")
}

var n = readline();

n = n.split(" ");
var m = n[1];
n = n[0];
var flag = true;
var s = [];
for (var i = 0; i < n; i++) {
    s.push(readline());
}
if ((n * m % 3) !== 0) { flag = false; } else {
    if (n % 3 == 0) {
        var width = n / 3;
        var tmpl = s[0][0] + s[width][0] + s[width * 2][0];
        if ((tmpl[0] === tmpl[1]) || (tmpl[0] === tmpl[2]) || (tmpl[2] === tmpl[1])) { flag = false; }
        for (var i = 0; i < width; i++) {
            for (var j = 0; j < m; j++) {
                if (tmpl !== s[i][j] + s[width + i][j] + s[width * 2 + i][j]) {
                    flag = false;
                }

            }
        }
    }
    if ((m % 3 == 0) && (!flag)) {
        width = m / 3;
        tmpl = s[0][0] + s[0][width] + s[0][width * 2];
        if ((tmpl[0] === tmpl[1]) || (tmpl[0] === tmpl[2]) || (tmpl[2] === tmpl[1])) { flag = false; }
        for (var i = 0; i < width; i++) {
            for (var j = 0; j < n; j++) {
                if (tmpl !== s[j][i] + s[j][width + i] + s[j][width * 2 + i]) {
                    flag = false;
                }
            }
        }
    }

}
if (flag) {
    print("YES")
} else {
    print("NO")
}

var n = readline();

n = n.split(" ");
var m = n[1];
n = n[0];
var flag = true;
var s = [];
for (var i = 0; i < n; i++) {
    s.push(readline());
}
if ((n * m % 3) !== 0) { flag = false; } else {
    if (n % 3 == 0) {
        var width = n / 3;
        var tmpl = s[0][0] + s[width][0] + s[width * 2][0];
        for (var i = 0; i < width; i++) {
            for (var j = 0; j < m; j++) {
                if (tmpl !== s[i][j] + s[width + i][j] + s[width * 2 + i][j]) {
                    flag = false;
                }
            }
        }
    }
    if ((m % 3 == 0) && (!flag)) {
        width = m / 3;
        tmpl = s[0][0] + s[0][width] + s[0][width * 2];
        for (var i = 0; i < width; i++) {
            for (var j = 0; j < n; j++) {
                if (tmpl !== s[j][i] + s[j][width + i] + s[j][width * 2 + i]) {
                    flag = false;
                }
            }
        }
    }

}
if (flag) {
    print("YES")
} else {
    print("NO")
}

var n = readline();

n = n.split(" ");
var m = n[1];
n = n[0];
var flag = true;
var s = [];
for (var i = 0; i < n; i++) {
    s.push(readline());
}
if ((n * m % 3) !== 0) { flag = false; } else {
    if (n % 3 === 0) {
        var width = n / 3;
        var tmpl = s[0][0] + s[width][0] + s[width * 2][0];
        if ((tmpl[0] === tmpl[1]) || (tmpl[0] === tmpl[2]) || (tmpl[2] === tmpl[1])) { flag = false; }
        if (((tmpl.indexOf("R") + 1) * (tmpl.indexOf("G") + 1) * (tmpl.indexOf("B") + 1)) === 0) {
            flag = false;
        }

        for (var i = 0; i < width; i++) {
            for (var j = 0; j < m; j++) {
                if (tmpl !== s[i][j] + s[width + i][j] + s[width * 2 + i][j]) {
                    flag = false;
                }

            }
        }
    } else { flag = false; }
    if ((m % 3 === 0) && (!flag)) {
        width = m / 3;
        tmpl = s[0][0] + s[0][width] + s[0][width * 2];
        if ((tmpl[0] === tmpl[1]) || (tmpl[0] === tmpl[2]) || (tmpl[2] === tmpl[1])) { flag = false; }
        if (((tmpl.indexOf("R") + 1) * (tmpl.indexOf("G") + 1) * (tmpl.indexOf("B") + 1)) === 0) {
            flag = false;
        }
        for (var i = 0; i < width; i++) {
            for (var j = 0; j < n; j++) {
                if (tmpl !== s[j][i] + s[j][width + i] + s[j][width * 2 + i]) {
                    flag = false;
                }
            }
        }
    }

}
if (flag) {
    print("YES")
} else {
    print("NO")
}


print(function(n, a) {

	var min = 1e9;
	var ans = [];
	for (var i = 1; i < n; i++) {
		var x = Math.abs(a[i] - a[i - 1]);
		if (x < min) {
			min = x;
			ans[0] = i;
			ans[1] = i + 1;
		}
	}
	var x = Math.abs(a[0] - a[a.length - 1]);
	if (x < min) {
		min = x;
		ans[0] = a.length;
		ans[1] = 1;
	}

	return ans.join(' ');

}(+readline(), readline().split(' ').map(Number)));

;(function () {

	print(function (n, a) {

		var min = Math.abs(a.slice(-1)[0] - a[0]),
			interval = [a.length, 1];

		for (var i = 0, _i = a.length - 1; i < _i && min !== 0; i++) {
			var dif = Math.abs(a[i] - a[i + 1]);
			if (dif < min) {
				min = dif;
				interval = [i + 1, i + 2];
			}
		}

		return interval.join(' ');

	}(+readline(), readline().split(' ').map(Number)));

}.call(this));

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var n = parseInt(readline());
	var heights = tokenizeIntegers(readline());

	var min = Math.abs(heights[n-1]-heights[0]), minPair = [n-1, 0];
	for (var i = 1; i < n; ++i) {
		var diff = Math.abs(heights[i-1]-heights[i]);
		if (diff < min) {
			min = diff;
			minPair = [i-1, i];
		}
	}

	print((minPair[0]+1)+" "+(minPair[1]+1));
}

main();

'use strict'

let N = +readline()
let lll = readline().split(' ').map(v => parseInt(v))

lll.push(lll[0])

let min = Infinity
let par = 2

for (let i = 1; i < lll.length; i++) {
  let dif = Math.abs(lll[i] - lll[i - 1])
  if (min > dif) {
    min = dif
    par = i
  }

}

print(par + ' ' + (par == lll.length - 1 ? 1 : par + 1))

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  let [min, minIndex] = [Math.abs(arr[len - 1] - arr[0]), [len, 1]];

  for (let i = 0; i < len - 1; i++) {
    const diff = Math.abs(arr[i] - arr[i + 1]);
    if (diff < min) {
      min = diff;
      minIndex = [i + 1, i + 2];
    }
  }
  console.log(`${minIndex[0]} ${minIndex[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;
  }

  const arr = d.split(' ').map(Number);
  let best = Math.abs(arr[0] - arr[arr.length - 1]);
  let x = 1;
  let y = arr.length;

  for (let i = 0; i < arr.length - 1; i++) {
    const current = Math.abs(arr[i] - arr[i + 1]);

    if (current < best) {
      best = current;
      x = i + 1;
      y = i + 2;
    }
  }

  console.log(x, y);

  c++;
});

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

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

function multiply(a, b) {
	a = a.toString(10).split('').reverse();
	b = b.toString(10).split('').reverse();

	if (a.length < b.length) {
		[a, b] = [b, a];
	}

	let res = Array(a.length + b.length).fill(0);
	for (let i = 0, lb = b.length; i < lb; ++i) {
		let carry = 0;
		let scarry = 0;
		for (let j = 0, la = a.length; j < la; ++j) {
			let m = b[i] * a[j];
			m += carry;

			if (m > 9) {
				let [c, d] = m.toString(10).split('');
				res[i + j] += (scarry >> 0) + (d >> 0);
				carry = c >> 0;
			} else {
				res[i + j] += (scarry >> 0) + m;
				carry = 0;
			}

			if (res[i + j] > 9) {
				let [c, d] = res[i + j].toString(10).split('');
				res[i + j] = d >> 0;
				scarry = c;
			} else {
				scarry = 0;
			}
		}
		if (carry > 0) res[a.length + i] = carry;
		if (scarry > 0) res[a.length + i] = scarry;
	}

	res.reverse();
	let mulVal = '';
	let flag = false;
	res.forEach(d => {
		if (!flag && d !== 0) flag = true;
		if (flag) mulVal += d;
	});
	return mulVal;
}

function main() {
	let n = readLine() >> 0;
	let h = readLine()
		.split(' ')
		.map(x => x >> 0);
	let d = Math.abs(h[0] - h[n - 1]);
	let x = 1,
		y = n;
	for (let i = 1; i < n; ++i) {
		let diff = Math.abs(h[i] - h[i - 1]);
		if (diff <= d) {
			d = diff;
			x = i;
			y = i + 1;
		}
	}
	console.log(x, y);
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let n = parseInt(readLine());
    let heights = readLine().split(' ').map(Number);
    let differences = Math.min();
    let pairs = [];
    for (let i = 0; i < heights.length; i++) {
        let diff = Math.abs(heights[i] - heights[i + 1]);
        if (diff < differences) {
            differences = diff;
            pairs.push([i + 1, i + 2]);
        }
    }
    if (Math.abs(heights[0] - heights[heights.length - 1]) < differences) {
        console.log(1, heights.length);
        return;
    }
    console.log(...pairs[pairs.length - 1]);
}

const readline = require('readline');

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

var n = -1;
var reconnaissance = [];

rl.on('line', function (input) {

    if (n == -1)
        n = parseInt(input);
    else {
          reconnaissance = input.split(' ').map(item => {return parseInt(item);});
        //****************************************** DO IT HERE*/

        var min = Math.abs(reconnaissance[0] - reconnaissance[reconnaissance.length - 1]);
        var ans = "1 " + reconnaissance.length;

        for(var i = 0; i< n-1; i++)
        {
            var temp = Math.abs(reconnaissance[i] - reconnaissance[i + 1]);
            if (min > temp)
                {
                    min = temp; ans = "" + (i + 1) + " " + (i + 2);
                }

        }
            console.log(ans);

            rl.close();
            /*************************************** */

    }

})

let fs = require("fs");

let txt = fs.readFileSync(0, "utf-8").split(/[\r\n]/).filter(data => data.length > 0);
for (let i = 0; i < txt.length; i += 2) {
    doit(txt[i + 1].split(" ").filter(data => data.length > 0).map(data => data * 1));
}

function doit(tab) {

    let changes = [];
    for (let i = 0; i < tab.length - 1; i++) {
        changes.push(Math.abs(tab[i] - tab[i + 1]));
    }
    changes.push(Math.abs(tab[0] - tab[tab.length - 1]));
    let index = changes.indexOf(Math.min(...changes));
    let next=index+2;
    if(next>tab.length)next-=tab.length;

    console.log(index + 1, next);

}

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

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

  const arr = d.split(' ').map(Number);
  let best = Infinity;
  let x = Infinity;
  let y = Infinity;

  for (let i = 0; i < arr.length - 1; i++) {
    for (let j = i + 1; j < arr.length; j++) {
      const current = Math.abs(arr[i] - arr[j]);

      if (current < best) {
        best = current;
        x = i + 1;
        y = j + 1;
      }
    }
  }

  console.log(x, y);

  c++;
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let n = parseInt(readLine());
    let heights = readLine().split(' ').map(Number);
    let differences = Math.min();
    let pairs = [];
    for (let i = 0; i < heights.length; i++) {
        let diff = Math.abs(heights[i] - heights[i + 1]);
        if (diff < differences) {
            differences = diff;
            pairs.push([i, i + 1]);
        }
    }
    if (Math.abs(heights[0] - heights[heights.length - 1]) < differences) {
        console.log(1, heights.length);
        return;
    }
    console.log(...pairs[pairs.length - 1]);
}

let fs = require("fs");

let txt = fs.readFileSync(0, "utf-8").split(/[\r\n]/).filter(data => data.length > 0);
for (let i = 0; i < txt.length; i += 2) {
    doit(txt[i + 1].split(" ").filter(data => data.length > 0).map(data => data * 1));
}

function doit(tab) {

    let changes = [];
    for (let i = 0; i < tab.length - 1; i++) {
        changes.push(Math.abs(tab[i] - tab[i + 1]));
    }
    changes.push(Math.abs(tab[0] - tab[tab.length - 1]));
    let index = changes.indexOf(Math.min(...changes));
    console.log(index + 1, (index + 2) % tab.length);

}

;(function () {

	print(function (n, a) {

		var min = 1e10, j;
		a.push(a[0]);

		for (var i = 0, _i = a.length - 1; i < _i; i++) {
			var r = Math.abs(a[i] - a[i + 1]);
			if (min > r) {
				min = r;
				j = i + 1;
			}
		}

		return [j, (j + 1)%(a.length - 1)].join(' ');

	}(+readline(), readline().split(' ').map(Number)));

}.call(this));


'use strict';

function solve(n, a, b) {
  a = a.map(num => {
    while (!(num & 1)) {
      num = num >> 1;
    }
    return num;
  }).sort((a, b) => b - a);
  b = b.map(num => {
    while (!(num & 1)) {
      num = num >> 1;
    }
    return num;
  }).sort((a, b) => a - b);
  const map = new Map();
  for (let [i, num] of b.entries()) {
    while (num) {
      if (num & 1) {
        if (!map.has(num)) map.set(num, []);
        map.get(num).push(i);
      }
      num >>= 1;
    }
  }
  const vis = new Array(n);
  for (let num of a) {
    if (!map.has(num)) return 'NO';
    const cur = map.get(num);
    while (cur.length && vis[cur[cur.length - 1]]) cur.pop();
    if (!cur.length) return 'NO';
    vis[cur[cur.length - 1]] = 1;
    cur.pop();
  }
  return 'YES';
}

async function main(read) {
  try {
    let t = Number(await read());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      const n = Number(await read());
      const a = (await read()).split(' ').map(Number);
      const b = (await read()).split(' ').map(Number);
      res[i] = solve(n, a, b);
    }
    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++) {
        l++
        const sa = lines[l++].trim().split(' ').map(Number)
        const sb = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(sa, sb)
    }
    console.log(output.join('\n'))
// })()
})

function solve(sa, sb) {
    const map = sa.reduce((o, x) => {
        while (!(x & 1)) x >>= 1
        o[x] = (o[x] || 0) + 1
        return o
    }, {})
    sb.sort((a, b) => b - a)
    for (let i = 0; i < sb.length; i++) {
        let x = sb[i]
        while (x > 1 && !map[x]) {
            x = Math.floor(x / 2)
        }
        if (!map[x]) return 'NO'
        map[x]--
    }
    return 'YES'
}