function minString(str) {
    var len = str.length;
    var removeIndex = len-1;
    for (var i = 0; i < len-1; i++) {
        if (str[i] > str[i+1]) {
            removeIndex = i;
            break;
        }
    }
    return str.slice(0, removeIndex) + str.slice(removeIndex +1);
}

const len = Number(readline());
const str = readline();
print(minString(str));

readline();
var str = readline();
var res;
for(var i = 1; i < str.length; i++) {
	if(str[i] < str[i - 1]) {
		res = str.substr(0, i - 1) + str.substr(i);
		break;
	}
}

if(!res) res = str.substr(0, str.length - 1);

print(res);

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

let l = 0;
rl.on('line', (input) => {
    if (l === 0) { l++ }
    else {
        rl.close();
        let max = 1
        let arr = input.split('')
        let curr=0
        let res=''
        let isRem = false
        for (let i = 0; i < arr.length-1;i++) {
             if(arr[i]>arr[i+1]&&!isRem){
                isRem= true
             } else {
                 res+=arr[i]
             }
        }
        res+=arr[arr.length-1]
        if(arr.length===res.length)
        {
            res=res.slice(0,res.length-1)
        }
        console.log(res)
        return 0;
    }
});

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

let l = 0;
rl.on('line', (input) => {
    if (l === 0) { l++ }
    else {
        rl.close();
        let max = 1
        let arr = input.split('')
        let curr=0
        let res=''
        let rem = true
        for (let i = 0; i < arr.length-1;i++) {
             if(arr[i]>arr[i+1]&&rem){
                    rem= false
             } else {
                 res+=arr[i]
             }
        }
        res+=arr[arr.length-1]
        if(arr.length===res.length)
        {
            res=res.slice(0,res.length-1)
        }
        console.log(res)
        return 0;
    }
});

const readline = require('readline');

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

var counter=0, N;
rl.on('line', (input) => {
    if(counter==0){
        N=parseInt(input);
        counter++;
    }
    else
    {
        if(N != 1){
            let ind = N-1;
            for(let i=0; i<N-1; i++){
                if(input[i]>input[i+1]){
                ind=i;
                break;
                }
            }
            input = input.substring(0, ind) + input.substring(ind + 1);

        }
        console.log(input);
        rl.close();
    }

  });

  /*

  input = "abcdefghi"
  input = "aaaaaaaaa"
  */

var length = parseInt(readline());

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

var removePos = length-1;

for(var i = 0; i< length-1; i++){
    if(string[i]>string[i+1]){
        removePos = i;
        break;
    }
}

string.splice(removePos,1)
print(string.join(''))

var cnt = parseInt(readline());
var line = readline();
for (var i = 1; i < cnt; i++) {
	if (line[i-1] > line[i]) {
		break;
    }
}
print(line.slice(0,i-1) + line.slice(i,line.length));

function solve(n, s) {
    for (var i=1; i<n; i++) {
        if (s.charCodeAt(i) < s.charCodeAt(i-1)) {
            return s.substring(0, i-1) + s.substring(i, n);
        }
    }

    return s.substring(0, n-1)
}

write(solve(+readline(), readline()))

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

let l = 0;
rl.on('line', (input) => {
    if (l === 0) { l++ }
    else {
        rl.close();
        let max = 1
        let arr = input.split('')
        let curr=0
        let res=''
        let rem = true
        for (let i = 0; i < arr.length-1;i++) {
             if(arr[i]>arr[i+1]&&rem){
                    rem= false
             } else {
                 res+=arr[i]
             }
        }
        res+=arr[arr.length-1]
        if(arr.length===res.length)
        {
            res=res.slice(1)
        }
        console.log(res)
        return 0;
    }
});

var length = parseInt(readline());

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

if(string[length -1] =='a'){
    string.splice(-1,1);
    length = string.length;
}

string[length - 1] = 'a';

print(string.join(''))

function minString(str) {
    var len = str.length;
    var removeIndex = len-1;
    for (var i = 0; i < len-1; i++) {
        if (str[i] > str[i+1]) {
            removeIndex = i;
        }
    }
    return str.slice(0, removeIndex) + str.slice(removeIndex +1);
}

const len = Number(readline());
const str = readline();
print(minString(str));


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

rl.on('line', (d) => {
  const n = +d;
  let curr = 0;
  let step = 1;
  let ans = '';

  for (let i = 0; i < n - 1; i++) {
    curr = (curr + step) % n;
    step++;
    ans += curr + 1 + ' ';
  }

  console.log(ans);

  // const ans = [2];
  // let inc = 1;

  // while(ans.length < n - 1) {
  //   inc++;
  //   const v = (ans[ans.length - 1] + inc) % n;
  //   ans.push(v === 0 ? n : v);
  // }

  // console.log(ans.join(' '));
});

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

rl.on('line', (d) => {
  const n = +d;
  const ans = [2];
  let inc = 1;

  while(ans.length < n - 1) {
    inc++;
    const v = (ans[ans.length - 1] + inc) % n;
    ans.push(v === 0 ? n : v);
  }

  console.log(ans.join(' '));
});

print(function(n) {
	var x = 2;
	var ans = [];
	for (var i = 1; i < n; i++) {
		ans.push(x);
		x = x + i + 1;
		if(x>n){
			x = x-n;
		}
	}
	return ans.join(' ');
}(readline()));

;(function () {

	print(function (n) {

		var q = 1, p = [], t = 1, r = n;
		while (--n) {
			p.push(((q += t++) % r) || r);
		}

		return p.join(' ');

	}(+readline()));

}.call(this));

'use strict'

let N = +readline()

let i = 0
let c = 1
let n = N
let r = []
while (--n) {
  i++
  c += i
  c = c % N
  r.push(c)
}

print(r.map(v => v || N).join(' '))

var readline = require('readline'),
    rl = readline.createInterface(process.stdin, process.stdout);

var n;

rl.on('line', function (line) {
   n = parseInt(line);

   let limit = n - 1, ind = 0, skip = 0, pos = 1;
   while (ind < limit)
   {
       pos += skip + 1;
       if (pos > n)
           pos = pos % n;

       process.stdout.write(pos + " ");
      // Console.Write("{0} ", pos);

       skip++;
       ind++;

   }
  rl.close();

}).on('close', function () {

    process.exit(0);
});

print(function(n) {
	var x = 2;
	var ans = [];
	for (var i = 1; i < n; i++) {
		ans.push(x);
		x = (x + i + 1) % n || n;
	}
	return ans.join(' ');
}(readline()));

'use strict'

let N = +readline()

let i = 0
let c = 1
let n = N
let r = []
while (--n) {
  i++
  c += i
  c = c % N
  r.push(c)
}

print(r.join(' '))

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

rl.on('line', (d) => {
  const n = +d;
  let curr = 0;
  let step = 1;
  let ans = '';

  for (let i = 0; i < n - 1; i++) {
    curr = (curr + step) % n;
    ans += curr + 1 + ' ';
  }

  console.log(ans);

  // const ans = [2];
  // let inc = 1;

  // while(ans.length < n - 1) {
  //   inc++;
  //   const v = (ans[ans.length - 1] + inc) % n;
  //   ans.push(v === 0 ? n : v);
  // }

  // console.log(ans.join(' '));
});

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

rl.on('line', (d) => {
  const n = +d;
  const ans = [2];
  let inc = 1;

  while(ans.length < n - 1) {
    inc++;
    const v = (ans[ans.length - 1] + inc) % n;
    ans.push(v);
  }

  console.log(ans.join(' '));
});


var n = parseInt(readline().trim())
var x;
var ans= []
var g = {}
var _g={}
for(var i=0;i<n;i++){
    x = readline().trim().split(' ').map((_x)=>parseInt(_x))
    g[x[0]]=x[1];
    _g[x[1]]=x[0];
}
var y = 0
do{

    if(g[y]==undefined)
        break;
    y=g[y];
    ans.push(-1);
    if(y==0)
    break;
    ans.push(y);
}while(y!=0)

var y,i
if(n%2==0){
    y=_g[0]
    i=n-2;
}else{
    for(var i in g){
        if(g[g[i]]==undefined){
            y=g[i]
            break
        }
    }
    i=n-1
}

do{
    ans[i]=y
    i-=2
    if(_g[y]==undefined)
        break;
    y=_g[y];

}while(y!=0)

print(ans.join(' '))


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 c = readLine()
		.split(' ')
		.map(x => x >> 0);

	let m = Math.min(...c);
	let d = 0;
	let p = 0;
	for (let i = 0; i < n; i++) {
		if (c[i] === m) {
			d++;
			p = i + 1;
		}
	}

	if (d > 1) console.log('Still Rozdil');
	else console.log(p);
}

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() {
  const len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  let [min, minIndex, minCount] = [Number.MAX_SAFE_INTEGER, -1, 0];

  for (let i = 0; i < len; i++) {
    const num = arr[i];
    if (num <= min) {
      if (num === min) minCount++;
      else minCount = 0;
      min = num;
      minIndex = i + 1;
    }
  }
  minCount === 0 ? console.log(minIndex) : console.log("Still Rozdil");
}

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 min = Infinity;
  let minIdx = Infinity;
  const obj = {};

  for (let i = 0; i < arr.length; i++) {
    if (min > arr[i]) {
      min = arr[i];
      minIdx = i + 1;
    }

    if (obj.hasOwnProperty(arr[i])) {
      obj[arr[i]]++;
    }
    else {
      obj[arr[i]] = 1;
    }
  }

  if (obj[min] === 1) {
    console.log(minIdx);
  }
  else {
    console.log('Still Rozdil');
  }

  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 distances = readLine().split(' ').map(Number);
    let lowest = Math.min(...distances);
    // for (let i = 0; i < n; i++) {
    //     if (
    //         distances.indexOf(distances[i]) !==
    //         distances.lastIndexOf(distances[i])
    //     ) {
    //         console.log('Still Rozdil');
    //         return;
    //     }
    // }
    if (distances.indexOf(lowest) !== distances.lastIndexOf(lowest)) {
        console.log('Still Rozdil');
        return;
    }

    console.log(distances.indexOf(lowest) + 1);
}

print(function(n) {
	var a = readline().split(' ').map(Number),
		min = Math.min.apply(0, a),
		i = a.indexOf(min),
		ii = a.indexOf(min, i+1);

	return ii > -1 ? 'Still Rozdil' : i + 1;

}(+readline()));

;(function () {

	var n = +readline();
	var a = readline().split(' ').map(Number);
	var m = Math.min.apply(0, a);
	var p = a.indexOf(m);

	print( p === a.lastIndexOf(m) ? p + 1 : 'Still Rozdil' );

}).call(this);

var n = readline();
var cnt = 0;
var j = 0;
var mn = 1000000000

var array = readline().split(" ").map((item)=>{return parseInt(item)});

array.forEach((item,idx)=>{
    if(item <= mn) {
        mn = item;
        j = idx;
    }
});

for (i = 0; i < n; i++) {
    if (array[i] == mn)
        cnt++;
}
if (cnt > 1) {
    print("Still Rozdil");
} else
    print(j + 1);

print(function(n) {
	var a = readline().split(' ').map(Number),
		min = Math.min.apply(0, a),
		i = a.indexOf(min),
		ii = a.indexOf(min, i);

	return ii > -1 ? 'Still Rozdil' : i + 1;

}(+readline()));

var n = readline();
var cnt = 0;
var j = 0;
var mn = 1000000000

var array = readline().split(" ").map((item)=>{return item});

array.forEach((item,idx)=>{
    if(item <= mn) {
        mn = item;
        j = idx;
    }
});

for (i = 0; i < n; i++) {
    if (array[i] == mn)
        cnt++;
}
if (cnt > 1) {
    print("Still Rozdil");
} else
    print(j + 1);

var n = readline();
var cnt = 0;
var j = 0;
var array = readline().split(" ");

var mn = array[0];
for (i = 1; i < n; i++) {
    if (array[i] <= mn) {
        mn = array[i];
        j = i;
    }
}
for (i = 1; i < n; i++) {
    if (array[i] == mn)
        cnt++;
}
if (cnt > 1) {
    print("Still Rozdil");
} else
    print(j + 1);

var n = readline();
var cnt = 0;
var j = 0;
var array = [];
for (i = 0; i < n; i++)
    array[i] = readline();
var mn = array[0];
for (i = 1; i < n; i++) {
    if (array[i] <= mn) {
        mn = array[i];
        j = i;
    }
}
for (i = 1; i < n; i++) {
    if (array[i] == mn)
        cnt++;
}
if (cnt > 1) {
    print("Still Rozdil");
} else
    print(j + 1);

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 distances = readLine().split(' ').map(Number);
    for (let i = 0; i < n; i++) {
        if (
            distances.indexOf(distances[i]) !==
            distances.lastIndexOf(distances[i])
        ) {
            console.log('Still Rozdil');
            return;
        }
    }

    let lowest = Math.min(...distances);
    console.log(distances.indexOf(lowest) + 1);
}

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 distances = readLine().split(' ').map(Number);
    for (let i = 0; i < n; i++) {
        if (
            distances.indexOf(distances[i]) !==
            distances.lastIndexOf(distances[i])
        ) {
            console.log('Still Rozdil');
            return;
        }
    }

    let lowest = Math.min(...distances);
    console.log(distances.indexOf(lowest));
}


'use strict';

let cin = '';
let current_line = 0;

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', line => { cin += line; });
process.stdin.on('end', _ => {
    cin = cin.trim().split('\n').map(line => { return line.trim(); });
    main(); });

function     next() { return cin[current_line++]; }
function  nextInt() { return parseInt(next()); }
function nextList() { return next().split(' ').map(s => parseInt(s)); }

function   print(x) { process.stdout.write(x); }
function println(x) { console.log(x); }

const digit = "012";

function solve(n) {
    const r = n%3;
    const m = n-2;
    let ans = "";
    let sum = 0;
    if (r == 1) {
        ans += "1";
        sum = 1; }
    while (sum < m) {
        ans += "21";
        sum += 3; }
    if (sum < n)
        ans += digit[n-sum];
    return ans; }

function main() {
    for (let t = nextInt(); t > 0; --t)
        println(solve(nextInt())); }

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

let num = -1;
const rows = [];
rl.on('line', line => {
    if (num < 0) {
        num = parseInt(line.trim());
    } else {
        rows.push(line.trim());
        if (rows.length === num) {
            dealInput(rows);
        }
    }
});
const dealInput = (rows) => {
    rows.forEach(item => {
        let m = item % 3;
        let n = parseInt(item / 3);
        let a = '1',
            b = '21';
        if (m === 1) {
            a = '1'
            b = '12'
        } else if (m === 2) {
            a = '2'
            b = '21'
        } else {
            a = ''
            b = '21'
        }
        console.log(setNum(n, b) + a);
    })
    rl.close();
};

function setNum(m, n) {
    if (m === 0) return ''
    let num = ''
    for (let i = 0; i < m; i++) {
        num += n
    }
    return num
}
rl.on('close', () => {
    process.exit(0);
});

let text = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', str => {
    if (str === '\r\n' || str === '\n') {
        process.stdin.emit('end');
    } else {
        text += str;
    }
});

process.stdin.on('end', () => {
    const input = text.trim().replace(/r/g, '').split('\n');
    const total = Number(input[0]);
    for (let i = 1; i <= total; i++) {
        solve(Number(input[i]));
    }

    process.exit();
});

function solve(number) {
    const mod = number % 3;
    const group = (number - mod) / 3;
    let result = '';
    if (mod < 2) {
        mod && (result = '1');
        result += '21'.repeat(group);
    } else {
        result = '2';
        result += '12'.repeat(group);
    }
    console.log(result);
}

function solve(arr) {
  let data = [...arr];
  data.shift();
  data = data.map((num) => parseInt(num));
  data.forEach((num) => {
    if (num === 1) {
      console.log(1);
    } else if (num === 2) {
      console.log(2);
    } else if (num === 3) {
      console.log(21);
    } else {
      const a = num % 3;
      const b = parseInt(num / 3);
      let str = "";
      for (let i = 0; i < b; i++) {
        str += "21";
      }
      if (a === 1) {
        console.log(`1${str}`);
      } else if (a === 2) {
        console.log(`${str}2`);
      } else {
        console.log(str);
      }
    }
  });
}
let text = "";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
process.stdin.on("data", (t) => {
  if (t === "\r\n" || t === "\n") {
    process.stdin.emit("end");
  } else {
    text += t;
  }
});
process.stdin.on("end", () => {
  const input = text.trim().replace(/\r/g, "").split("\n");
  solve(input);
  process.exit();
});

function repeat(num, t){
    var ans = '';
    if(t === 0){

    }
    if(t == 1){
        ans += 1;
    }
    for(j = 0; j < num; j++){
        ans += 21;
    }
    if(t == 2){
        ans += 2;
    }
    console.log(ans);
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(i = 1; i <= n; i++){
        var k = lines[i];
        var a = Math.floor(k / 3);
        if(k % 3 === 0){
            repeat(a, 0);
        }else if(k % 3 == 1){
            repeat(a, 1);
        }else{
            repeat(a, 2);
        }
    }
});

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

let ls = [];

function solve(){
    let i = 1;
    while (i < ls.length){
        const n = parseInt(ls[i++]);
        let sum = 0;
        let num = n % 3 == 1 ? 1 : 2;
        let ans = '';
        while (sum < n){
            ans += num;
            sum += num;
            num = 3 - num;
        }
        console.log(ans);
    }
}

rl.on('line', (l) => ls.push(l));
rl.on('close', () => solve());

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() {
  const testCases = readline();

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

    let next = 2;
    if (n % 3 === 1) {
      next = 1;
    }

    let length = Math.ceil(n / 3) * 2;
    if (n % 3 !== 0) {
      length--;
    }

    let result = "";
    for (let i = 0; i < length; i++) {
      // result *= 10;
      // result += next;
      result = result + next;
      if (next === 2) {
        next = 1;
      } else {
        next = 2;
      }
    }

    console.log(result);
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(s => s.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 = parseInt(readline(), 10);

        let res = '';
        if (n % 3 === 1) {
            output('12'.repeat(Math.floor(n / 3)) + '1');
        } else if (n % 3 === 2) {
            let base = '21'.repeat(Math.floor(n / 3))
            output(base + '2');
        } else {
            output('21'.repeat(n/3));
        }
    }
}

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

module.exports = E;

const ra = ()=>readline().split(' ').map(a=>+a)

const EPS = 1e-6;

const calc = (n)=>{
  let res = '';
  let start = 2;
  let m = n
  debugger
  while (m>0){
    res += start;
    m -= start;
    start = start==1 ? 2 : 1;
  }
  if (m==0)
    return res;
  res = '';
  start = 1;
  m = n;
  while (m>0){
    res += start;
    m -= start;
    start = start==1 ? 2 : 1;
  }
  return res;
};

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

E.calc = calc;

//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 N = nextInt();
		var one = N % 2;
		var two = Math.floor(N / 2);
		while(Math.abs(two - one) > 1){
			two--;
			one += 2;
		}

		var output = [];
		if(one > two){
			output.push(1);
			one--;
		}
		while(one > 0 && two > 0){
			output.push(2);
			output.push(1);
			one--;
			two--;
		}
		if(two > 0){
			output.push(2);
		}
		myout(myconv(output, 0));
	}
}

function solve() {
   const n = Number(read());
   const div3 = Math.floor(n / 3);
   const mod3 = n % 3;
   let ans = '21'.repeat(div3);
   if (mod3 === 1) {
      ans = '1' + ans;
   }
   if (mod3 === 2) {
      ans = ans + '2';
   }
   write(ans);
}

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

function modPow(a, n, mod) {
   let d = a;
   let curN = n;
   let ans = 1n;
   while(curN) {
      if (curN & 1n) {
         ans = modMul(ans, d, mod);
      }
      curN >>= 1n;
      d = modMul(d, d, mod);
   }
   return ans;
}

function modMul(a, b, mod) {
   return (a * b) % mod;
}

function modSum(a, b, mod) {
   return (a + b) % mod;
}

function modDiff(a, b, mod) {
   return (a + mod - b) % mod;
}

function isZero(num) {
   if (typeof num === 'bigint') {
      return num === 0n;
   }
   return num === 0;
}
function div(a, b) {
   if (typeof a !== typeof b) {
      throw new Error('Different types on division');
   }
   if (typeof a === 'bigint') {
      return a / b;
   }
   return Math.floor(a / b);
}

function gcd(x, y) {
   if (isZero(y)) {
      return x;
   }
   return gcd(y, x % y);
}

function lcm(x, y) {
   return div(x * y, gcd(x, y));
}

function allIndexOf(arr, value) {
   var index = arr.indexOf(value)
   var ans = [];
   while (index !== -1) {
      ans.push(index);
      index = arr.indexOf(value, index + 1);
   }
   return ans;
}

function xor(a, b, k) {
   if (k === 2) {
      return a ^ b;
   }
}

function decToBin(num) {
   let n = num;
   const ans = [];
   while(n > 0) {
      ans.push(n & 1);
      n = (n >> 1);
   }
   return ans;
}

function binToDec(binN) {
   let ans = 0;
   for (let i = binN.length - 1; i >= 0; i--) {
      ans = ((ans << 1) | binN[i]);
   }
   return ans;
}

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, print } = require('@ip-algorithmics/codeforces-io');

function readLineNumbers() {
  return readline().split(' ').map(x => parseInt(x))
}

function getSequenceToSum(sum, start) {
  var last = start;
  var sumOfDigits = start;
  var finalNumber = '' + start;

  while (sumOfDigits < sum) {
    var digit = last === 1 ? 2 : 1
    sumOfDigits += digit;
    finalNumber += digit;
    last = digit;
  }

  return [sumOfDigits, finalNumber];
}

var n = readLineNumbers()[0]

while (n--) {
  var sum = readLineNumbers()[0];

  var a = getSequenceToSum(sum, 1)
  var b = getSequenceToSum(sum, 2)

  if (a[0] === sum && b[0] === sum) {
    print ( a[0] > b[0] ? a[1] : b[1]  )
  } else {
    print(a[0] === sum ? a[1] : b[1]);
  }
}

var tests = parseInt(readline());
    var n;

    for (var t=0; t < tests; t++) {
        n = parseInt(readline());
		var ans = [];

		var num = 2;
		if (n % 3 == 1) {
			num = 1;
		}
		while (n > 0) {
			ans.push(num);
			n -= num;
			if (num == 1) {
				num = 2;
			} else {
				num = 1;
			}
		}
		print(ans.join(''));
    }

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];

    for(j = 1; j <= n; j++){
        a = lines[j]
        s = 0
        answer = ''
            if(a % 3 == 1){
                while(s < a){
                    s += 1
                    answer += 1
                    if(s + 2 < a){
                        s += 2
                        answer += 2
                    }
                }
                console.log(answer)
            }else{
                while(s < a){
                    s += 2
                    answer += 2
                    if(s + 1 <= a){
                        s += 1
                        answer += 1
                    }
                }
                console.log(answer)
            }
    }

});

'use strict';

let cin = '';
let current_line = 0;

function     next() { return cin[current_line++]; }
function  nextInt() { return parseInt(next()); }
function nextList() { return next().split(' ').map(s => parseInt(s)); }
function   print(x) { process.stdout.write(x); }
function println(x) { console.log(x); }

const digit = "012";

function solve(n) {
    let ans = "";
    let x = (n%3 == 1) ? 1 : 2;
    while (n > 0) {
        n -= x; ans += digit[x]; x = 3-x; }
    return ans; }

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', line => { cin += line; });
process.stdin.on('end', _ => {
    cin = cin.trim().split('\n').map(line => { return line.trim(); });
    for (let t = nextInt(); t > 0; --t)
        println(solve(nextInt())); });

'use strict';

let cin = '';
let current_line = 0;

function     next() { return cin[current_line++]; }
function  nextInt() { return parseInt(next()); }
function nextList() { return next().split(' ').map(s => parseInt(s)); }
function   print(x) { process.stdout.write(x); }
function println(x) { console.log(x); }

const digit = "012";

function solve(n) {
    const r = n%3;
    const m = n-2;
    let ans = "";
    let sum = 0;
    if (r == 1) {
        ans += "1";
        sum = 1; }
    while (sum < m) {
        ans += "21";
        sum += 3; }
    if (sum < n)
        ans += digit[n-sum];
    return ans; }

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', line => { cin += line; });
process.stdin.on('end', _ => {
    cin = cin.trim().split('\n').map(line => { return line.trim(); });
    for (let t = nextInt(); t > 0; --t)
        println(solve(nextInt())); });

'use strict';

let cin = '';
let current_line = 0;

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', line => { cin += line; });
process.stdin.on('end', _ => {
    cin = cin.trim().split('\n').map(line => { return line.trim(); });
    main(); });

function     next() { return cin[current_line++]; }
function  nextInt() { return parseInt(next()); }
function nextList() { return next().split(' ').map(s => parseInt(s)); }

const digit = "012";

function solve(n) {
    let ans = "";
    let sum = 0;
    const r = n%3;
    if (r == 1) {
        ans += "1";
        sum = 1; }
    const m = n-2;
    while (sum < m) {
        ans += "21";
        sum += 3; }
    if (sum < n)
        ans += digit[n-sum];
    return ans; }

function main() {
    for (let t = nextInt(); t > 0; --t)
        console.log(solve(nextInt())); }

"use strict";

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

let inputStr = "";
let currentLne = 0;

process.stdin.on('data' , inputStdin =>{

	 inputStr += inputStdin;
})

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

main();
})

function readline(){
   return inputStr[currentLne++];
}

function main(){

    let t = parseInt(readline()) ;
    let c =0;
    while(c<t){
       let num =  parseInt(readline()) ;

            let s = "";
            let t ="21";
            let b =0;
            let d =0;
            let x =0;
            let k="";
            let l="";
            let m="";

            function gen21(total){
                let count =0;
                let add = "";
                while(count<total){
                    add +="21";
                    count++;
                }
                return add;
            }

            if(num%3 ==0){
                x = num/3;
                m = gen21(x);
                console.log(m);
            }
            if((num-1)%3 == 0 ){
               b = (num-1)/3;
               k = gen21(b);
               s = "1"+ k;
               console.log(s)
            }
            if((num+1)%3 == 0){
                d = (num+1)/3;
                l = gen21(d);
                l = l.split("")

                l.splice(-1,1);

               l = l.join("");
               console.log(l)
            }

        c++;
    }

}

//type input.txt | node code.js

let buf='';

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

process.stdin.on('end', function(){
    const {EOL}=require('os');
    let line=buf.split(EOL);
    let t=parseInt(line[0]);
    let a=[];
    for(let i=1;i<=1000;i++)
    {
        if(i&1) a.push(1);
        else a.push(2);
    }
    for(let _=1;_<=t;_++)
    {
        let n=parseInt(line[_]);
        let ans=0;
        let sum=0;
        let x=0;
        let str='';
        while(sum<n)
        {
            str+=a[x];
            sum+=a[x++];
        }
        if(sum==n) ans=str;
        sum=0;
        x=1;
        str='';
        while(sum<n)
        {
            str+=a[x];
            sum+=a[x++];
        }
        if(sum==n) ans=str;
        console.log(ans);
    }
})

let buf='';

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

process.stdin.on('end', function(){
    const {EOL}=require('os');
    let line=buf.split(EOL);
    let t=parseInt(line[0]);
    let a=[];
    for(let i=1;i<=1000;i++)
    {
        if(i&1) a.push(1);
        else a.push(2);
    }
    for(let _=1;_<=t;_++)
    {
        let n=parseInt(line[_]);
        // console.log(n);
        let ans=0;
        let sum=0;
        let x=0;
        let str='';
        while(sum<n)
        {
            str+=a[x];
            sum+=a[x++];
        }
        if(sum==n) ans=str;
        sum=0;
        x=1;
        str='';
        while(sum<n)
        {
            str+=a[x];
            sum+=a[x++];
        }
        if(sum==n) ans=str;
        console.log(ans);
    }
})

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var k = lines[0];
    var s = ''
    var n = 0
    var g = false
    for(j = 1; j <= k; j++){
        var a = lines[j]
        while(n <= a){
            if(g === false){
            s += '1'
            n += 1
            a -= 1

            if(n + 1 >= a){
                s += '2'
            n += 2
            a -= 2
            }
            } else if(g === true){
               s += '2'
            n += 2
            a -= 2
            if(n + 2 >= a){
            s += '1'
            n += 1
            a -= 1
}
            }
        }
            console.log(s)

    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var k = lines[0];
    var s = ''
    var n = 0
    var g = false
    for(j = 1; j <= k; j++){
        var a = lines[j]
        while(n <= a){
            if(g === false){
            s += '1'
            n += 1
            a -= 1

            if(n + 1 != a){
                s += '2'
            n += 2
            a -= 2
            }
            } else if(g === true){
               s += '2'
            n += 2
            a -= 2
                        if(n + 2 != a){
s += '1'
            n += 1
            a -= 1
}
            }
        }
            console.log(s)

    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var k = lines[0];
    var s = ''
    var n = 0
    var g = false
    for(j = 1; j <= k; j++){
        var a = lines[j]
        while(n <= a){
            if(g === false){
            s += '1'
            n += 1
            a -= 1

            if(n + 2 == a){
                s += '2'
            n += 2
            a -= 2
            }
            } else if(g === true){
               s += '2'
            n += 2
            a -= 2
                        if(n + 1 == a){
s += '1'
            n += 1
            a -= 1
}
            }
        }
            console.log(s)

    }
});

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

    }
});

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

    }
});

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

'use strict';

let cin = '';
let current_line = 0;

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', line => { cin += line; });
process.stdin.on('end', _ => {
    cin = cin.trim().split('\n').map(line => { return line.trim(); });
    main(); });

function     next() { return cin[current_line++]; }
function  nextInt() { return parseInt(next()); }
function nextList() { return next().split(' ').map(s => parseInt(s)); }

function solve(n) {
    let ans = "";
    let sum = 0;
    if (n%3 == 2) {
        ans += "2";
        sum = 2; }
    const m = n-2
    while (sum < m) {
        ans += "12";
        sum += 3; }
    if (sum < n)
        ans += "1";
    return ans; }

function main() {
    for (let t = nextInt(); t > 0; --t)
        console.log(solve(nextInt())); }

'use strict';

let cin = '';
let current_line = 0;

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', line => { cin += line; });
process.stdin.on('end', _ => {
    cin = cin.trim().split('\n').map(line => { return line.trim(); });
    main(); });

function     next() { return cin[current_line++]; }
function  nextInt() { return parseInt(next()); }
function nextList() { return next().split(' ').map(s => parseInt(s)); }

function solve(n) {
    let ans = "";
    if (n%3 == 2)
        ans += "2";
    const m = n-1;
    while (ans.length < m)
        ans += "12";
    if (ans.length < n)
        ans += "1";
    return ans; }

function main() {
    for (let t = nextInt(); t > 0; --t)
        console.log(solve(nextInt())); }

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

let num = -1;
const rows = [];
rl.on('line', line => {
    if (num < 0) {
        num = parseInt(line.trim());
    } else {
        rows.push(line.trim());
        if (rows.length === num) {
            dealInput(rows);
        }
    }
});
const dealInput = (rows) => {
    rows.forEach(item => {
        if(item <= 2) {
            console.log(item);
        }else {
            console.log(getNum(item));
        }
    })
    rl.close();
};
function getNum(num) {
    let s = 0
    if(num%2 ===1) {
        s = 2
    } else {
        s = 1
    }
    return setS(s,num)
}
function setS(s,num) {
    let ss = String(s)
    for(let i = s; i < num;) {
        if(ss[ss.length-1] == 1) {
            ss += '2'
            i += 2
        } else {
            ss += '1'
            i += 1
        }
    }
    return ss
}
rl.on('close', () => {
    process.exit(0);
});

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() {
  const testCases = readline();

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

    let next = 2;
    if (n % 3 === 1) {
      next = 1;
    }

    let length = Math.ceil(n / 3) * 2;
    if (n % 3 !== 0) {
      length--;
    }

    let result = 0;
    for (let i = 0; i < length; i++) {
      result *= 10;
      result += next;
      if (next === 2) {
        next = 1;
      } else {
        next = 2;
      }
    }

    console.log(result);
  }
}

function readLineNumbers() {
  return readline().split(' ').map(x => parseInt(x))
}

function getSequenceToSum(sum, start) {
  var last = start;
  var sumOfDigits = start;
  var finalNumber = start;

  while (sumOfDigits < sum) {
    var digit = last === 1 ? 2 : 1
    sumOfDigits += digit;
    finalNumber = finalNumber * 10 + digit;
    last = digit;
  }

  return [sumOfDigits, finalNumber];
}

var n = readLineNumbers()[0]

while (n--) {
  var sum = readLineNumbers()[0];

  var a = getSequenceToSum(sum, 1)
  var b = getSequenceToSum(sum, 2)

  if (a[0] === sum && b[0] === sum) {
    print ( a[0] > b[0] ? a[1] : b[1]  )
  } else {
    print(a[0] === sum ? a[1] : b[1]);
  }
}

function readLineNumbers() {
  return readline().split(' ').map(x => parseInt(x))
}

function getSequenceToSum(sum, start) {
  var last = start;
  var sumOfDigits = start;
  var finalNumber = start;

  while (sumOfDigits < sum) {
    var digit = last === 1 ? 2 : 1
    sumOfDigits += digit;
    finalNumber = finalNumber * 10 + digit;
    last = digit;
  }

  return sumOfDigits === sum ? finalNumber : -1;
}

var n = readLineNumbers()[0]

while (n--) {
  var sum = readLineNumbers()[0];

  var a = getSequenceToSum(sum, 1)
  var b = getSequenceToSum(sum, 2)
  print(a === -1 ? b : a);
}


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 => {
    var t = Number(input[0]);
    var j = 1;
    for (var m = 1; m <= t; m++) {
        var n = Number(input[j]);
        j++;
        var arr = input[j].split(" ").map((i) => {
            return Number(i);
        });
        j++;
        var count = 0;
        for (var i = 0; i < arr.length; i++) {
            if (arr[i] === 1 || arr[i] === 3) {
                count++;
            }
        }
        console.log(count);
    }
})

var t = readline();
    for(var i = 0 ; i < t ; i++){
        var n =readline(),
            reviewers = readline().split(' ') , counter = 0;
            for(var j = 0 ; j < n ; j++){
                if(reviewers[j] == 1 || reviewers[j] == 3){
                    counter++;
                }
            }
            print(counter);
    }

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

var maxN = 2 * 1e5 + 10
var mod = BigInt(1e9 + 7)

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const xx = readline();
  Array(Number(xx)).fill(1).map((t, i) => {
    var n = parseInt(readline());
    // var [n, m] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // })
    // var [x, y] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // });
    var a = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    })
    var l1 = 0
    var d1 = 0
    var l2 = 0
    var d2 = 0

    for (let i = 0; i < n; i++) {
      if (a[i] === 1 || a[i] ===3) {
        l1 += 1
        continue
      }
    }

    console.log(l1 + l2)

  })
}

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

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

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i= 0; i < t; i++){
		nl.num();
		let cnt = nl.nums().reduce((ac, e) => (e != 2)?ac + 1:ac, 0);
		ans.push(cnt);
	}
	console.log(ans.join('\n'));
};

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

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

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i= 0; i < t; i++){
		nl.num();
		let cnt = nl.nums().filter(e => e != 2).length;
		ans.push(cnt);
	}
	console.log(ans.join('\n'));
};

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

//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 list = nextIntArray(N);
		var L = 0;
		var R = 0;
		for(var j = 0; j < N; j++){
			if(list[j] != 2){
				L++;
			}
		}
		myout(L);
	}
}

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

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

function main(){
    let t = +readLine();
    while(t--){
        let n = +readLine();
        let a = readLine().split(' ').map(Number);
        let ans = 0;
        for(let i=0; i<a.length; i++){
            if(a[i] === 2){
                continue;
            }
            ans++;
        }
        console.log(ans);
    }
}

'use-strict'

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

let data = '';
let currentLine = 0;

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

process.stdin.on('end', () =>{
    data = data.replace(/\s*$/, '')
    .split('\n')
    .map(str => str.replace(/\s*$/, ''));

    let testCases = parseInt(readLine());

    while(testCases--) {

        const n = parseInt(readLine());

        const r = readLine().split(' ').map(Number);

        let max = 0;

        for(let i = 0 ; i < n ; i++){
            max += r[i] === 2 ? 0 : 1;
        }

        console.log(max);
    }
});

function get_ints() {
    return data.shift().split(' ').map(Number);
}

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

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

var maxN = 2 * 1e5 + 10
var mod = BigInt(1e9 + 7)

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const xx = readline();
  Array(Number(xx)).fill(1).map((t, i) => {
    var n = parseInt(readline());
    // var [n, m] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // })
    // var [x, y] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // });
    var a = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    })
    var l1 = 0
    var d1 = 0
    var l2 = 0
    var d2 = 0

    for (let i = 0; i < n; i++) {
      if (a[i] === 1) {
        l1 += 1
      }
      if (a[i] === 2) {
        d2 += 1
      }
      if (a[i] === 3 && l1 === 0) {
        l1 = 1
        continue
      }
      if (a[i] === 3 && d2 >= l2) {
        l2 += 1
      } else {
        d2 += 1
      }
    }

    console.log(l1 + l2)

  })
}

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

var maxN = 2 * 1e5 + 10
var mod = BigInt(1e9 + 7)

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const xx = readline();
  Array(Number(xx)).fill(1).map((t, i) => {
    var n = parseInt(readline());
    // var [n, m] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // })
    // var [x, y] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // });
    var a = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    })
    var l1 = 0
    var d1 = 0
    var l2 = 0
    var d2 = 0

    for (let i = 0; i < n; i++) {
      if (a[i] === 1) {
        l2 += 1
      }
      if (a[i] === 2) {
        d1 += 1
      }
      if (a[i] === 3 && d1 >= l1) {
        l1 += 1
        continue
      }
      if (a[i] === 3 && d2 >= l2) {
        l2 += 1
        continue
      }
      if (a[i] === 3) d1++
    }

    console.log(l1 + l2)

  })
}

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

//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 list = nextIntArray(N);
		var L = 0;
		var R = 0;
		for(var j = 0; j < N; j++){
			if(list[j] == 1){
				L++;
			}else if(list[j] == 2){
				R++;
			}else{
				if(L < R){
					R++;
				}else{
					L++;
				}
			}
		}
		myout(L);
	}
}

"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 t=readline();
    while(t--){
        var ans=0;
        var n=readline();
        for(var i=1;i<=n;i++){
            var a=readline();
            if(a==1) ans++;
            else if(a==3) ans++;
        }
        console.log(ans);
    }

}


var n = +readline();

for(var i = 0; i < n; i++) {
  var k = +readline();

  var robots = [];

  for(var j = 0; j < k; j++) {
    robots.push(readline().split(' ').map(item => +item));
  }

  var x1 = Math.max(-100000, ...robots.filter(item => item[2] === 0).map(item => item[0]));
  var y1 = Math.min(100000, ...robots.filter(item => item[3] === 0).map(item => item[1]));
  var x2 = Math.min(100000, ...robots.filter(item => item[4] === 0).map(item => item[0]));
  var y2 = Math.max(-100000, ...robots.filter(item => item[5] === 0).map(item => item[1]));
  if(x2 < x1 || y1 < y2) {
    print(0);
  } else {
    print(1, x1, y2);
  }
}

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var q = rdN();
    while (q --> 0) {
        var n = rdN();
        var T = +100000;
        var B = -100000;
        var L = -100000;
        var R = +100000;
        for (var i = 0; i < n; ++i) {
            var input = rdArN();
            var x = input[0];
            var y = input[1];
            var f1 = input[2];
            var f2 = input[3];
            var f3 = input[4];
            var f4 = input[5];
            if (!f1) { // L-move
                L = Math.max(L, x);
            }
            if (!f2) { // T-move
                T = Math.min(T, y);
            }
            if (!f3) { // R-move
                R = Math.min(R, x);
            }
            if (!f4) { // B-move
                B = Math.max(B, y);
            }
        }
        if (L > R || B > T) {
            pr(0);
        } else {
            pr(1, L, T);
        }
    }
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const rdS=readline;
const rdN=()=>+rdS();
const rdArS=()=>rdS().split(' ');
const rdArN=()=>rdArS().map(v=>+v);
const wr=write;
const pr=print;
const prAr=(a)=>pr(...a);
const prOb=(o)=>pr(JSON.stringify(o,null,4));
const cmpLt=(a,b)=>a-b;
const cmpGt=(a,b)=>b-a;
const crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);};
const getPrimes=function(n){var sieve=crAr(n+1,true);for(var i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}var primes=[];for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;};
const defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{configurable:true,enumerable:false,value:v});
defineProperty(Array.prototype,'sortLt',function(){return this.sort(cmpLt);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort(cmpGt);});
defineProperty(Set.prototype,'union',function(s){return new Set([...this,...s]);});
defineProperty(Set.prototype,'intersection',function(s){return new Set([...this].filter((v)=>s.has(v)));});
defineProperty(Set.prototype,'difference',function(s){return new Set([...this].filter((v)=>!s.has(v)));});

main();
return OUTPUT;
})();

var n = +readline();

for(var i = 0; i < n; i++) {
  var k = +readline();

  var robots = [];

  for(var j = 0; j < k; j++) {
    robots.push(readline().split(' ').map(item => +item));
  }

  var x1 = Math.max(...robots.filter(item => item[2] === 0).map(item => item[0]));
  var y1 = Math.min(...robots.filter(item => item[3] === 0).map(item => item[1]));
  var x2 = Math.min(...robots.filter(item => item[4] === 0).map(item => item[0]));
  var y2 = Math.max(...robots.filter(item => item[5] === 0).map(item => item[1]));
  x1 === -Infinity && (x1 = -10000);
  y1 === Infinity && (y1 = 10000);
  x2 === Infinity && (x2 = 10000);
  y2 === -Infinity && (y2 = -10000);
  if(x2 < x1 || y1 < y2) {
    print(0);
  } else {
    print(1, x1, y2);
  }
}

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var q = rdN();
    while (q --> 0) {
        var n = rdN();
        var T = +100000;
        var B = -100000;
        var L = -100000;
        var R = +100000;
        for (var i = 0; i < n; ++i) {
            var input = rdArN();
            var x = input[0];
            var y = input[1];
            var f1 = input[2];
            var f2 = input[3];
            var f3 = input[4];
            var f4 = input[5];
            if (!f1) { // L-move
                L = Math.max(L, x);
            }
            if (!f2) { // T-move
                T = Math.min(T, x);
            }
            if (!f3) { // R-move
                R = Math.min(R, x);
            }
            if (!f4) { // B-move
                B = Math.max(B, x);
            }
        }
        if (L > R || B > T) {
            pr(0);
        } else {
            pr(1, L, T);
        }
    }
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const rdS=readline;
const rdN=()=>+rdS();
const rdArS=()=>rdS().split(' ');
const rdArN=()=>rdArS().map(v=>+v);
const wr=write;
const pr=print;
const prAr=(a)=>pr(...a);
const prOb=(o)=>pr(JSON.stringify(o,null,4));
const cmpLt=(a,b)=>a-b;
const cmpGt=(a,b)=>b-a;
const crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);};
const getPrimes=function(n){var sieve=crAr(n+1,true);for(var i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}var primes=[];for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;};
const defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{configurable:true,enumerable:false,value:v});
defineProperty(Array.prototype,'sortLt',function(){return this.sort(cmpLt);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort(cmpGt);});
defineProperty(Set.prototype,'union',function(s){return new Set([...this,...s]);});
defineProperty(Set.prototype,'intersection',function(s){return new Set([...this].filter((v)=>s.has(v)));});
defineProperty(Set.prototype,'difference',function(s){return new Set([...this].filter((v)=>!s.has(v)));});

main();
return OUTPUT;
})();


'use strict';

var fs = require('fs');

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

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

function solve(n, c, data) {
  const set = new Set(data);
  if (!set.has(1)) return 'NO';
  let sum = new Array(c + 10).fill(0);

  for (let i = 1; i < sum.length; i++) {
    sum[i] = sum[i - 1] + (set.has(i) ? 1 : 0);
  }

  for (let i = 2; i <= c; i++) {
    for (let j = i; j <= c / i; j++) {
      let left, right;

      if (set.has(i) && !set.has(j)) {
        var _sum;
        left = sum[i * j - 1], right = (_sum = sum[i * (j + 1) - 1]) !== null && _sum !== void 0 ? _sum : sum[sum.length - 1];
      } else if (set.has(j) && !set.has(i)) {
        var _sum2;
        left = sum[i * j - 1], right = (_sum2 = sum[(i + 1) * j - 1]) !== null && _sum2 !== void 0 ? _sum2 : sum[sum.length - 1];
      } else continue;

      const cur = right - left;
      if (cur) return 'NO';
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

function solve(n, c, data) {
  const set = new Set(data);
  if (!set.has(1)) return 'NO';
  let sum = new Array(c + 10).fill(0);

  for (let i = 1; i < sum.length; i++) {
    sum[i] = sum[i - 1] + (set.has(i) ? 1 : 0);
  }

  for (let i = 2; i <= c / i; i++) {
    for (let j = i; j <= c / i; j++) {
      let left, right;

      if (set.has(i) && !set.has(j)) {
        var _sum;
        left = sum[i * j - 1], right = (_sum = sum[i * (j + 1) - 1]) !== null && _sum !== void 0 ? _sum : sum[sum.length - 1];
      } else if (set.has(j) && !set.has(i)) {
        var _sum2;
        left = sum[i * j - 1], right = (_sum2 = sum[(i + 1) * j - 1]) !== null && _sum2 !== void 0 ? _sum2 : sum[sum.length - 1];
      } else continue;

      const cur = right - left;
      if (cur) return 'NO';
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

function solve(n, c, data) {
  const set = new Set(data);
  if (!set.has(1)) return 'NO';
  let sum = new Array(c + 10).fill(0);

  for (let i = 1; i < sum.length; i++) {
    sum[i] = sum[i - 1] + (set.has(i) ? 1 : 0);
  }

  for (let i = 2; i <= c / i; i++) {
    for (let j = i; j <= c / i; j++) {
      var _sum;

      const left = sum[i * j - 1],
            right = (_sum = sum[i * (j + 1) - 1]) !== null && _sum !== void 0 ? _sum : sum[sum.length - 1];
      const cur = right - left;
      if (!cur) continue;

      if (set.has(i) && !set.has(j) || set.has(j) && !set.has(i)) {
        return 'NO';
      }
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

function solve(n, c, data) {
  data.sort((a, b) => a - b);
  const sum = [0];
  const set = new Set(data);
  if (!set.has(1)) return 'NO';

  for (let i = 1; i <= c + 10; i++) {
    sum[i] = sum[i - 1] + (set.has(i) ? 1 : 0);
  }

  for (let i = 2; i <= c / 2; i++) {
    for (let j = i; j <= c / i; j++) {
      let right = i * (j + 1) - 1 > c ? sum[sum.length - 1] : sum[i * (j + 1) - 1],
          left = i * j - 1 > c ? sum[sum.length - 1] : sum[i * j - 1];
      const cur = right - left;
      if (set.has(i) && !set.has(j) && cur || !set.has(i) && set.has(j) && cur) return 'NO';
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

function solve(n, c, data) {
  data.sort((a, b) => a - b);
  const sum = [0];
  const set = new Set(data);
  if (!set.has(1)) return 'NO';

  for (let i = 1; i <= c; i++) {
    sum[i] = sum[i - 1] + (set.has(i) ? 1 : 0);
  }

  for (let i = 2; i <= c; i++) {
    for (let j = i; j <= c / i; j++) {
      var _sum, _sum2;

      const cur = ((_sum = sum[i * (j + 1) - 1]) !== null && _sum !== void 0 ? _sum : sum[sum.length - 1]) - ((_sum2 = sum[i * j - 1]) !== null && _sum2 !== void 0 ? _sum2 : sum[sum.length - 1]);

      if (set.has(i) && !set.has(j) && cur > 0 || !set.has(i) && set.has(j) && cur > 0) {
        return 'NO';
      }
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

function solve(n, c, data) {
  data.sort((a, b) => a - b);
  const sum = [0];
  const set = new Set(data);
  if (!set.has(1)) return 'NO';

  for (let i = 1; i <= c; i++) {
    sum[i] = sum[i - 1] + (set.has(i) ? 1 : 0);
  }

  for (let i = 2; i <= c / i; i++) {
    for (let j = i; j <= c / i; j++) {
      var _sum, _sum2;

      const cur = ((_sum = sum[i * (j + 1) - 1]) !== null && _sum !== void 0 ? _sum : sum[sum.length - 1]) - ((_sum2 = sum[i * j - 1]) !== null && _sum2 !== void 0 ? _sum2 : sum[sum.length - 1]);

      if (set.has(i) && !set.has(j) && cur > 0 || !set.has(i) && set.has(j) && cur > 0) {
        return 'NO';
      }
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

function solve(n, c, data) {
  data.sort((a, b) => a - b);
  const sum = [0];
  const set = new Set(data);
  if (!set.has(1)) return 'NO';

  for (let i = 1; i <= c; i++) {
    sum[i] = sum[i - 1] + (set.has(i) ? 1 : 0);
  }

  for (let i = 2; i <= c / i; i++) {
    for (let j = i; j <= c / i; j++) {
      var _sum;

      const cur = ((_sum = sum[i * (j + 1) - 1]) !== null && _sum !== void 0 ? _sum : sum[sum.length - 1]) - sum[i * j - 1];

      if (set.has(i) && !set.has(j) && cur > 0 || !set.has(i) && set.has(j) && cur > 0) {
        return 'NO';
      }
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

class SegTree {
  constructor(n) {
    this.n = n;
    this.root = this._newNode(0, n);
    this.add = this._add.bind(this, this.root);
    this.query = this._query.bind(this, this.root);
  }

  _newNode(l, r, val = false, left = null, right = null) {
    return {
      val,
      l,
      r,
      left,
      right
    };
  }

  _add(node, x) {
    if (!node) return;
    const {
      l,
      r
    } = node;

    if (l === r) {
      node.val = true;
      return;
    }

    const mid = Math.floor((l + r) / 2);

    if (!node.left) {
      node.left = this._newNode(l, mid);
      node.right = this._newNode(mid + 1, r);
    }

    if (x <= mid) this._add(node.left, x);else this._add(node.right, x);
    node.val = node.left.val || node.right.val;
  }

  _query(node, x, y) {
    if (y < x) return false;
    if (!node) return false;
    const {
      l,
      r
    } = node;
    if (l === x && r === y) return node.val;
    let res = false,
        mid = Math.floor((l + r) / 2);
    if (y <= mid) res = this._query(node.left, x, y);else if (x > mid) res = this._query(node.right, x, y);else res = this._query(node.left, x, mid) || this._query(node.right, mid + 1, y);
    return res;
  }

}

function solve(n, c, data) {
  data.sort((a, b) => a - b);
  const segTree = new SegTree(c + 10);

  for (let num of data) {
    segTree.add(num);
  }

  const set = new Set(data);
  if (!set.has(1)) return 'NO';

  const primes = [],
        nums = new Array(c).fill(1);
  nums[0] = nums[1] = 0;

  for (let i = 2; i <= c; i++) {
    if (nums[i]) primes.push(i);

    for (let j of primes) {
      const k = j * i;
      if (k > c) break;
      nums[k] = 0;
      if (set.has(i) || set.has(j)) {
        const hasProduct = segTree.query(k, (i + 1) * j - 1);

        if (set.has(i) && !set.has(j) && hasProduct || !set.has(i) && set.has(j) && hasProduct) {
          return 'NO';
        }
      }

      if (i % k === 0) break;
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

class SegTree {
  constructor(n) {
    this.n = n;
    this.root = this._newNode(0, n);
    this.add = this._add.bind(this, this.root);
    this.query = this._query.bind(this, this.root);
  }

  _newNode(l, r, val = false, left = null, right = null) {
    return {
      val,
      l,
      r,
      left,
      right
    };
  }

  _add(node, x) {
    if (!node) return;
    const {
      l,
      r
    } = node;

    if (l === r) {
      node.val = true;
      return;
    }

    const mid = Math.floor((l + r) / 2);

    if (!node.left) {
      node.left = this._newNode(l, mid);
      node.right = this._newNode(mid + 1, r);
    }

    if (x <= mid) this._add(node.left, x);else this._add(node.right, x);
    node.val = node.left.val || node.right.val;
  }

  _query(node, x, y) {
    if (y < x) return false;
    if (!node) return false;
    const {
      l,
      r
    } = node;
    if (l === x && r === y) return node.val;
    let res = false,
        mid = Math.floor((l + r) / 2);
    if (y <= mid) res = this._query(node.left, x, y);else if (x > mid) res = this._query(node.right, x, y);else res = this._query(node.left, x, mid) || this._query(node.right, mid + 1, y);
    return res;
  }

}

function solve(n, c, data) {
  data.sort((a, b) => a - b);
  const segTree = new SegTree(c + 10);

  for (let num of data) {
    segTree.add(num);
  }

  const set = new Set(data);
  if (!set.has(1)) return 'NO';

  const primes = [],
        nums = new Array(c).fill(1);
  nums[0] = nums[1] = 0;

  for (let i = 2; i <= c; i++) {
    if (nums[i]) primes.push(i);

    for (let j of primes) {
      const k = j * i;
      if (k > c) break;
      nums[k] = 0;
      const hasProduct = segTree.query(k, (i + 1) * j - 1);

      if (set.has(i) && !set.has(j) && hasProduct || !set.has(i) && set.has(j) && hasProduct) {
        return 'NO';
      }

      if (i % k === 0) break;
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();

'use strict';

var fs = require('fs');

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

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

class SegTree {
  constructor(n) {
    this.n = n;
    this.root = this._newNode(0, n);
    this.add = this._add.bind(this, this.root);
    this.query = this._query.bind(this, this.root);
  }

  _newNode(l, r, val = false, left = null, right = null) {
    return {
      val,
      l,
      r,
      left,
      right
    };
  }

  _add(node, x) {
    if (!node) return;
    const {
      l,
      r
    } = node;

    if (l === r) {
      node.val = true;
      return;
    }

    const mid = Math.floor((l + r) / 2);

    if (!node.left) {
      node.left = this._newNode(l, mid);
      node.right = this._newNode(mid + 1, r);
    }

    if (x <= mid) this._add(node.left, x);else this._add(node.right, x);
    node.val = node.left.val || node.right.val;
  }

  _query(node, x, y) {
    if (y < x) return false;
    if (!node) return false;
    const {
      l,
      r
    } = node;
    if (l === x && r === y) return node.val;
    let res = false,
        mid = Math.floor((l + r) / 2);
    if (y <= mid) res = this._query(node.left, x, y);else if (x > mid) res = this._query(node.right, x, y);else res = this._query(node.left, x, mid) || this._query(node.right, mid + 1, y);
    return res;
  }

}

function solve(n, c, data) {
  data.sort((a, b) => a - b);
  const segTree = new SegTree(c + 10);

  for (let num of data) {
    segTree.add(num);
  }

  const set = new Set(data);
  if (!set.has(1)) return 'NO';

  for (let i = 2; i < c; i++) {
    let hasi = set.has(i);

    for (let j = i; j * i <= c; j++) {
      const hasProduct = segTree.query(i * j, i * (j + 1) - 1);
      if (hasi && set.has(j) && hasProduct || !hasi && !set.has(j) && !hasProduct) continue;
      return 'NO';
    }
  }

  return 'YES';
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, c] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const data = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    const res = solve(n, c, data);
    console.log(res);
  }
}();