You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.

For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any.

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

function main() {
    const t = parseInt(readLine(), 10);
    for(let i = 0; i < t; i++){
        const arr = readLine().split(' ').map(p => +p);
        myFunc(arr[0], arr[1], arr[2]);
    }
}

function myFunc(n, l, r){
    let resp = [], aux;
    for(let i = 1; i <= n; i++){
        if(l%i == 0) resp.push(l);
        else{
            aux = parseInt(l/i)*i + i;
            if(aux > r){
                console.log('NO');
                return;
            }
            resp.push(aux);
        }
    }

    console.log('YES');
    let imprime = resp.join(' ');
    console.log(imprime);

}

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

/*
 * Complete the 'queensAttack' function below.
 *
 * The function is expected to return an INTEGER.
 * The function accepts following parameters:
 *  1. INTEGER n
 *  2. INTEGER k
 *  3. INTEGER r_q
 *  4. INTEGER c_q
 *  5. 2D_INTEGER_ARRAY obstacles
 */
const generateArray = (start, end, n) => {
  const resultArray = [];

  if (n > end) {
    console.log('NO');
    return 'invalid';
  }

  for (let i = 1; i <= n; i += 1) {
    // start <= element <= end
    // start <=  i * y  <= end
    // start/i <= y <= end

    const y = Math.ceil(start / i);
    if (y > end / i) {
        console.log('NO');
      return 'invalid';
    }

    resultArray.push(i * y);
  }
  console.log('YES');
  console.log(resultArray.join(' '));
  return resultArray;
};

function main() {

    const numberOFTestCases = readLine();

    for(let i=0; i<numberOFTestCases;i++){
        const [n,start,end]= readLine().split(' ');
        generateArray(parseInt(start),parseInt(end),parseInt(n));
    }

}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var a = lines[i].split(' ').map(Number);
        var n = a[0], l = a[1], r = a[2];
        var flag = true;
        for(j = 1; j <= n; j++){
            if(Math.floor(r / j) * j < l){
                flag = false;
            }
        }
        if(!flag){
            console.log('NO');
        }else{
            console.log('YES');
            var ans = '';
            for(j = 1; j <= n; j++){
                ans += Math.floor(r / j) * j + ' ';
            }
            console.log(ans);
        }
    }
});

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

function main() {
  const t = readline();

  for (let i = 0; i < t; i++) {
    const [n, l, r] = readline().split(' ').map(num => +num);

    // console.log(`=----------------testcase ${i + 1}----------------=`);
    // console.log('q', q);
    // console.log('a', a);

    const output = f(n, l, r);

    console.log(output);
  }
}

function f(n, l, r) {
  // console.log('=>>>>', n, l, r)
  const ans = [];
  for(let i = 1; i <= n; i ++) {
    const factor = Math.floor(r / i);
    const aFactor = factor * i;
    if(aFactor >= l) ans.push(aFactor)
    else return 'NO';
  }
  return 'YES\n'+ans.join(' ')
}

'use strict';

function solve(n, l, r) {
  const res = new Array(n);
  for (let i = 1; i <= n; i++) {
    const x = Math.ceil(l / i);
    if (x * i > r) return 'NO';
    res[i - 1] = x * i;
  }
  return `YES\n${res.join(' ')}`;
}

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

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

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

function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
function abs(x) {
  return x < 0 ? x*(-1) : x;
}
// console.log(input)
var T = readline();
// var inf = 1000000000000;
for(var tc=1;tc<=T;tc++) {
 // var n = readline()//.split(' ').map((x) => parseInt(x));
  var [n,l,r] = readline().split(' ').map((x) => parseInt(x));
  var ans = [];
  // ans.push(l);
  for(var i=1;i<=n;i++) {
    if(l%i == 0) {
      ans.push(l)
      continue;
    }
    var val = (l-(l%i))+i;
    if(val >= l && val <= r) ans.push(val);
  }
  // console.log(ans)
  if(ans.length < n) console.log("NO")
  else {
    console.log("Yes")
    console.log(ans.join(" "));
  }
}

var tests = parseInt(readline());
    for (var t=0; t < tests; t++) {
        var nlr = readline().split(' ').map(x=>parseInt(x));
        var ans = [];
        var reply = 'YES';
        for (var i = 1; i <= nlr[0];i++) {
            var min = (Math.floor((nlr[1]-1)/i) + 1) * i;
            if (min <= nlr[2]) {
                ans.push(min);
            } else {
                reply = 'NO';
                break;
            }
        }
        print(reply);
        if (reply == 'YES') {
            print(ans.join(' '));
        }
    }

const main = () => {

	// gcds must be 1, 2, 3...
	var t = readInt();
	var allans = [];
	for (var zz = 0; zz < t; zz++) {
		var arr = readIntArr();
		var n, l, r, ans, ans2;
		n = arr[0]; l = arr[1]; r = arr[2];
		ans = 'YES';
		ans2 = [];
		for (var i = 1; i < n + 1; i++) {
			var val = parseInt(r / i) * i;
			if (val < l) {
				ans = 'NO';
				break;
			}
			ans2.push(val);
		}
		allans.push([ans]);
		if (ans === 'YES')
			allans.push(ans2);
	}
	multiLineArrayOfArraysPrint(allans);

	return;
}

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

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

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

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

function main() {
    const t = parseInt(readLine(), 10);
    for(let i = 0; i < t; i++){
        const arr = readLine().split(' ').map(p => +p);
        myFunc(arr[0], arr[1], arr[2]);
    }
}

function myFunc(n, l, r){
    let resp = [];
    for(let i = 1; i <= n; i++){
        if(l%i == 0) resp.push(l);
        else{
            l = parseInt(l/i)*i + i;
            if(l > r){
                console.log('NO');
                return;
            }
            resp.push(l);
        }
    }
    if(resp.length >= n){
        console.log('YES');
        console.log(...resp);
    }
    else{
        console.log('NO');
    }

}

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

function main() {
    const t = parseInt(readLine(), 10);
    for(let i = 0; i < t; i++){
        const arr = readLine().split(' ').map(p => +p);
        myFunc(arr[0], arr[1], arr[2]);
    }
}

function myFunc(n, l, r){
    let resp = [];
    for(let i = 1; i <= n; i++){
        if(l%i == 0) resp.push(l);
        else{
            l = parseInt(l/i)*i + i;
            if(l > r){
                console.log('NO');
                return;
            }
            resp.push(l);
        }
    }
    console.log('YES');
    console.log(...resp);
}

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

    function main() {
        const t = parseInt(readLine(), 10);
        for(let i = 0; i < t; i++){
            const arr = readLine().split(' ').map(p => +p);
            let result = myFunc(arr[0], arr[1], arr[2]);
        }
    }

    function gcd(a,  b){
        if (a == 0) return b;
        return gcd(b % a, a);
    }

    function myFunc(n, l, r){
        let map = new Map();
        let resp = [];
        let cont = 1;
        let aux;

        for(let j = l; j <= r; j++){
            aux = gcd(cont, j);
            if(!map.has(aux)){
                map.set(aux, j);
                resp.push(j);
                cont++
            }
            if(resp.length >= n) break;
        }

        // console.log(map);
        if(resp.length >= n){
            console.log('YES');
            console.log(...resp);
        }
        else{
            console.log('NO');
        }

    }

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

    function main() {
        const t = parseInt(readLine(), 10);
        for(let i = 0; i < t; i++){
            const arr = readLine().split(' ').map(p => +p);
            let result = myFunc(arr[0], arr[1], arr[2]);
        }
    }

    function gcd(a,  b){
        if (a == 0) return b;
        return gcd(b % a, a);
    }

    function myFunc(n, l, r){
        let map = new Map();
        let used = new Map();
        let resp = [];
        let cont = 0;
        let aux;
        for(let i = 0; i < n; i++){
            if(cont >= n) break;
            for(let j = l; j <= r; j++){
                aux = gcd(i+1, j);
                if(!map.has(aux) && !used.has(j)){
                    map.set(aux, i+1);
                    used.set(j, 1);
                    resp.push(j);
                    cont++;
                    break;
                }
            }
        }
        if(cont >= n){
            console.log('YES');
            console.log(...resp);
        }
        else{
            console.log('NO');
        }

    }

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

/*
 * Complete the 'queensAttack' function below.
 *
 * The function is expected to return an INTEGER.
 * The function accepts following parameters:
 *  1. INTEGER n
 *  2. INTEGER k
 *  3. INTEGER r_q
 *  4. INTEGER c_q
 *  5. 2D_INTEGER_ARRAY obstacles
 */
const generateArray = (start, end, n) => {
  const resultArray = [];

  if (n > end) {
    console.log('NO');
    return 'invalid';
  }

  for (let i = 1; i <= n; i += 1) {
    // start <= element <= end
    // start <=  i * y  <= end
    // start/i <= y <= end

    const y = Math.ceil(start / i);
    if (y > end / i) {
        console.log('NO');
      return 'invalid';
    }

    resultArray.push(i * y);
  }
  console.log('YES');
  console.log(resultArray);
  return resultArray;
};

function main() {

    const numberOFTestCases = readLine();

    for(let i=0; i<numberOFTestCases;i++){
        const [n,start,end]= readLine().split(' ');
        generateArray(parseInt(start),parseInt(end),parseInt(n));
    }

}

function gcd(a, b) {
        while (a != 0 && b != 0) {
            if (a > b) {
                a = a % b;
            } else {
                b = b % a;
            }
        }
        return Math.max(a, b);
    }

    var tests = parseInt(readline());
    for (var t=0; t < tests; t++) {
        var nlr = readline().split(' ').map(x=>parseInt(x));
        var set = new Set();
        var ans = [];
        for (var i = 0; i < nlr[0];i++) {
            ans.push(0);
        }
        for (var i = nlr[1]; i <= nlr[2]; i++) {
            for (var j = 1; j<=nlr[0]; j++) {
                if (ans[j-1] == 0 ) {
                    var d = gcd(j, i);
                    if (!set.has(d)) {
                        ans[j-1] = i;
                        set.add(d);
                        break;
                    }
                }
            }
        }
        var reply = 'YES';
        for (var i = 0; i < nlr[0];i++) {
            if (ans[i] == 0) {
                reply = 'NO';
            }
        }
        print(reply);
        if (reply == 'YES') {
            print(ans.join(' '));
        }
    }


Today, Wet Shark is given n bishops on a 1000 by 1000 grid. Both rows and columns of the grid are numbered from 1 to 1000. Rows are numbered from top to bottom, while columns are numbered from left to right.Wet Shark thinks that two bishops attack each other if they share the same diagonal. Note, that this is the only criteria, so two bishops may attack each other (according to Wet Shark) even if there is another bishop located between them. Now Wet Shark wants to count the number of pairs of bishops that attack each other.

The first line of the input contains n (1 ≤ n ≤ 200 000) — the number of bishops. Each of next n lines contains two space separated integers xi and yi (1 ≤ xi, yi ≤ 1000) — the number of row and the number of column where i-th bishop is positioned. It's guaranteed that no two bishops share the same position.

Output one integer — the number of pairs of bishops which attack each other.

NoteIn the first sample following pairs of bishops attack each other: (1, 3), (1, 5), (2, 3), (2, 4), (3, 4) and (3, 5). Pairs (1, 2), (1, 4), (2, 5) and (4, 5) do not attack each other because they do not share the same diagonal.

// main.apply(0, readline().split(' ').map(function(v) {
    // return v - 0;
// }));
// function main(d, L, v1, v2) {
    // print((L - d) / (v1 + v2));
// }

// var print = console.log.bind(console);

// var lines =
// `3
// 1 1
// 2 3
// 3 5`.split("\n");
// function readline() {
    // var l = lines.n || 0;
    // lines.n = l + 1;
    // return lines[l];
// }

var n = readline() - 0;
var a={}, b={};
for (var i = -1005; i <= 2005; i++) {
    a[i] = b[i] = 0;
}
for (var i = 0; i < n; i++) {
    var m = readNums();
    a[m[1] - m[0] + 1]++;
    b[m[1] + m[0] - 1]++;
}
var sum = 0;
for (var i = -1005; i <= 2005; i++) {
    sum += calc(a[i]) + calc(b[i]);
}
print(sum);

function calc(n) {
    if (n > 1)
        return n * (n - 1) / 2;
    return 0;
}

function readNums() {
    return readline().split(' ').map(function(v) {
        return v - 0;
    })
}

var n = Number(readline()); //number of bishops

var bishop_position = [];

for (var i = 0; i < n; i++) {
	var bishop = readline().split(' ').map(Number);
	bishop_position[i] = {row: bishop[0], col: bishop[1]};
}

var bishop1 = [];

for (var i = 0; i < n; i++) {
	bishop1[i] = bishop_position[i].row - bishop_position[i].col;
}

var counts = {};

for (var i = 0; i < n; i++) {
	if (bishop1[i] in counts) {
		counts[bishop1[i]] += 1;
	} else {
		counts[bishop1[i]] = 1;
	}
}

var nc2 = function(m) {
	return m * (m - 1) / 2;
}

var attack = 0;

for (var key in counts) {
	attack += nc2(counts[key]);
}

// checking for other diagonal
var bishop2 = [];

for (var i = 0; i < n; i++) {
	bishop2[i] = bishop_position[i].row + bishop_position[i].col;
}

var counts2 = {};

for (var i = 0; i < n; i++) {
	if (bishop2[i] in counts2) {
		counts2[bishop2[i]] += 1;
	} else {
		counts2[bishop2[i]] = 1;
	}
}

for (var key in counts2) {
	attack += nc2(counts2[key]);
}

print(attack);

var maxSize = 1000;
var n = Number(readline());
var arr1 = new Array(2 * maxSize - 1);
var arr2 = new Array(2 * maxSize - 1);
for (var i = 0; i < arr1.length; ++i) {
    arr1[i] = arr2[i] = 0;
}

for (var i = 0; i < n; ++i) {
    var num = readline().split(" ", 2);
    var a = Number(num[0]);
    var b = Number(num[1]);
    ++arr1[b - a + maxSize - 1];
    ++arr2[a + b - 2];
}

function getCn2(n) {
    return n * (n - 1) / 2;
}

var sum = 0;
for (var i = 1; i < 2 * maxSize - 2; ++i) {
    sum += getCn2(arr1[i]);
    sum += getCn2(arr2[i]);
}

print(sum);

var result = 0;

var n = parseInt(readline());
var bishops = [];
var l = new Object();
var r = new Object();
var bishop;
for (var i = 0; i < n; i++) {
    bishop = readline().split(' ').map(Number);
    if (l[(bishop[0] + bishop[1])]) {
        l[(bishop[0] + bishop[1])]++;
    } else {
        l[(bishop[0] + bishop[1])] = 1;
    }
    if (r[(bishop[0] - bishop[1])]) {
        r[(bishop[0] - bishop[1])]++;
    } else {
        r[(bishop[0] - bishop[1])] = 1;
    }
}

for(var index in l) {
    result += l[index] * (l[index] - 1) / 2;
}
for(var index in r) {
    result += r[index] * (r[index] - 1) / 2;
}

print(result);

// main.apply(0, readline().split(' ').map(function(v) {
    // return v - 0;
// }));
// function main(d, L, v1, v2) {
    // print((L - d) / (v1 + v2));
// }

// var print = console.log.bind(console);

// var lines =
// `3
// 1 1
// 2 3
// 3 5`.split("\n");
// function readline() {
    // var l = lines.n || 0;
    // lines.n = l + 1;
    // return lines[l];
// }

var n = readline() - 0;
var a={}, b={};
for (var i = -1000; i <= 1000; i++) {
    a[i] = b[i] = 0;
}
for (var i = 0; i < n; i++) {
    var m = readNums();
    a[m[1] - m[0] + 1]++;
    b[m[1] + m[0] - 1]++;
}
var sum = 0;
for (var i = -1000; i <= 1000; i++) {
    sum += calc(a[i]) + calc(b[i]);
}
print(sum);

function calc(n) {
    if (n > 1)
        return n * (n - 1) / 2;
    return 0;
}

function readNums() {
    return readline().split(' ').map(function(v) {
        return v - 0;
    })
}

var n = Number(readline());
var num1 = 0, num2 = 0;

for (var i = 0; i < n; ++i) {
    var num = readline().split(" ", 2);
    var a = Number(num[0]);
    var b = Number(num[1]);
    if (a === b) {
        ++num1;
    }
    if (a + b === n + 1) {
        ++num2;
    }
}

print(num1 * (num1 - 1) /2 + num2 * (num2 - 1) / 2);

var maxSize = 1000;
var n = Number(readline());
var arr1 = new Array(2 * maxSize - 1);
var arr2 = new Array(2 * maxSize - 1);
for (var i = 0; i < n; ++i) {
    arr1[i] = arr2[i] = 0;
}

for (var i = 0; i < n; ++i) {
    var num = readline().split(" ", 2);
    var a = Number(num[0]);
    var b = Number(num[1]);
    ++arr1[b - a + maxSize - 1];
    ++arr2[a + b - 2];
}

function getCn2(n) {
    return n * (n - 1) / 2;
}

var sum = 0;
for (var i = 1; i < 2 * maxSize - 2; ++i) {
    sum += getCn2(arr1[i]);
    sum += getCn2(arr2[i]);
}

print(sum);

var n = Number(readline());
var num1 = 0, num2 = 0;

for (var i = 0; i < n; ++i) {
    var num = readline().split(" ", 2);
    var a = Number(num[0]);
    var b = Number(num[1]);
    if (a === b) {
        ++num1;
    }
    if (a + b === 1001) {
        ++num2;
    }
}

print(num1 * (num1 - 1) /2 + num2 * (num2 - 1) / 2);


Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:There are two arrays of integers $$$a$$$ and $$$b$$$ of length $$$n$$$. It turned out that array $$$a$$$ contains only elements from the set $$$\{-1, 0, 1\}$$$.Anton can perform the following sequence of operations any number of times:   Choose any pair of indexes $$$(i, j)$$$ such that $$$1 \le i < j \le n$$$. It is possible to choose the same pair $$$(i, j)$$$ more than once.   Add $$$a_i$$$ to $$$a_j$$$. In other words, $$$j$$$-th element of the array becomes equal to $$$a_i + a_j$$$. For example, if you are given array $$$[1, -1, 0]$$$, you can transform it only to $$$[1, -1, -1]$$$, $$$[1, 0, 0]$$$ and $$$[1, -1, 1]$$$ by one operation.Anton wants to predict if it is possible to apply some number (zero or more) of these operations to the array $$$a$$$ so that it becomes equal to array $$$b$$$. Can you help him?

Each test contains multiple test cases.  The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10000$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)  — the length of arrays. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$-1 \le a_i \le 1$$$)  — elements of array $$$a$$$. There can be duplicates among elements. The third line of each test case contains $$$n$$$ integers $$$b_1, b_2, \dots, b_n$$$ ($$$-10^9 \le b_i \le 10^9$$$)  — elements of array $$$b$$$. There can be duplicates among elements. It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$10^5$$$.

For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing the described operations, or "NO" if it's impossible. You can print each letter in any case (upper or lower).

NoteIn the first test-case we can choose $$$(i, j)=(2, 3)$$$ twice and after that choose $$$(i, j)=(1, 2)$$$ twice too. These operations will transform $$$[1, -1, 0] \to [1, -1, -2] \to [1, 1, -2]$$$In the second test case we can't make equal numbers on the second position.In the third test case we can choose $$$(i, j)=(1, 2)$$$ $$$41$$$ times. The same about the fourth test case.In the last lest case, it is impossible to make array $$$a$$$ equal to the array $$$b$$$.

const ascending = (x, y) => x - y;
const descending = (x, y) => y - x;
const log = console.log;

function solve(input) {
    input = input.toString().split(/\r?\n/);

    let T = +input[0];
    let res = [];

    for (let t = 1, inputRow = 1; t <= T; t++) {

        let n = +input[inputRow++];
        let fpos = {
            '0': -1,
            '-1': -1,
            '1': -1
        };

        let a = input[inputRow++].split(' ').map(x => +x);
        let b = input[inputRow++].split(' ').map(x => +x);

        for (let i = 0; i < n; i++) {
            if (a[i] == -1 && fpos['-1'] == -1) {
                fpos['-1'] = i;
            }
            if (a[i] == 0 && fpos['0'] == -1) {
                fpos['0'] = i;
            }
            if (a[i] == 1 && fpos['1'] == -1) {
                fpos['1'] = i;
            }
        }

        let ans = 'YES';

        for (let i = n - 1; i >= 0; i--) {

            if (a[i] == b[i]) {
                continue;
            }
            if (b[i] > a[i] && (fpos['1'] == -1 || fpos['1'] >= i)) {
                ans = 'NO';
                break;
            }
            if (b[i] < a[i] && (fpos['-1'] == -1 || fpos['-1'] >= i)) {
                ans = 'NO';
                break;
            }

        }

        res.push(ans);
    }

    return res.join('\n');
}

async function main() {

    try {

        let input = await new Promise(resolve => {

            let _input = '';
            process.stdin.resume();
            process.stdin.setEncoding('utf-8');
            process.stdin.on('data', (buf) => {
                _input += buf;
            });
            process.stdin.on('end', () => {
                resolve(_input);
            });

        });
        let output = solve(input);

        console.log(output);

    } catch (err) {
        console.error(err);
    }
}

main();

// Q: https://codeforces.com/contest/1333/problem/B

const readline =  require('readline');

let input = [];

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

rl.on('line', lineInput => {
	input.push(lineInput);
});

rl.on('close', () => {
    const test = parseInt(input[0]);
    let n, a, b;
	for (let t=0; t < test; t++) {
        n = parseInt(input[3*t+1]);
        a = input[3*t+2].split(' ').map((a) => parseInt(a));
        b = input[3*t+3].split(' ').map((b) => parseInt(b));
        console.log(solution (a, b, n));
	}
});

function solution(a, b, n) {
    if (b[0] !== a[0]) {
        return 'NO';
    } else {
        let posIdx = a[0] === 1 ? true : false;
        let negIdx = a[0] === -1 ? true : false;
        for (let i = 1; i < n; i++) {
            if (b[i] > a[i] && !posIdx) {
                return 'NO';
            } else if (b[i] < a[i] && !negIdx) {
                return 'NO';
            }
            if (!posIdx) {
                posIdx = a[i] === 1 ? true : false;
            }
            if (!negIdx) {
                negIdx = a[i] === -1 ? true : false;
            }
        }
        return 'YES';
    }
}

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

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

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

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

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

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  let t = readInt()
  while(t--) {
    const n = readInt()
    const a = readInts()
    const b = readInts()

    if(a[0] !== b[0]) {
      wr('NO')
    }
    else {
      let flags = [false, false, false]
      let f = true
      if(a[0] < 0) flags[2] = true
      else flags[a[0]] = true
      for(let i = 1; i < n && f; i++) {
        let d = b[i] - a[i]
        if(d > 0) {
          if(!flags[1]) {
            f = false
          }
        }
        else if(d < 0) {
          if(!flags[2]) {
            f = false
          }
        }
        if(a[i] < 0) flags[2] = true
        else flags[a[i]] = true
      }
      if(f) wr('YES')
      else wr('NO')
    }
  }
}

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

function solve(n, a, b) {
  const addPos = a.includes(1) ? a.indexOf(1) : n;
  const minusPos = a.includes(-1) ? a.indexOf(-1) : n;

  return b.every((val, i) => val === a[i] || (val > a[i] && addPos < i) || (val < a[i] && minusPos < i)) ? 'YES' : 'NO';
}

function main() {
  let currentLine = 0;
  const readLine = (_) => lines[currentLine++].split(' ').map((val) => parseInt(val));

  const test = readLine()[0];
  for (let t = 1; t <= test; ++t) {
    const n =readLine()[0];
    const a = readLine();
    const b = readLine();
    console.log(solve(n, a, b));
  }
}

var tests = parseInt(readline())
for (var l = 0; l < tests;l++)
{
	var size = parseInt(readline())
	var a = readline().split(' ').map(c => parseInt(c))
	var b = readline().split(' ').map(c => parseInt(c))
	var flag = true
	var one = a.indexOf(1), minus_one = a.indexOf(-1)
	for(var i = size-1; i>-1;i--){
		if (a[i] != b[i]){
			var check = b[i]-a[i]
			if (check < 0){
				if (minus_one == -1 || minus_one >= i){
					print('No')
					flag = false
					break
				}
			}
			else{
				if (one == -1 || one >= i){
					print('No')
					flag = false
					break
				}
			}
		}
	}
	if (flag){
		print('Yes')
	}
}

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
//atcoderのサンプルは最後に改行入れること
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
    var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var n = nextInt();
    var alist = nextIntArray();
    var blist = nextIntArray();
    if(alist[0] != blist[0]){
      output[i] = "NO";
      continue;
    }
    //右から確定したい
    //jより左に欲しいものがあるか
    //b[j]>a[j]なら1、b[j]>a[j]なら-1があってほしい
    var plus = [];
    var minus = [];
    for(var j = 0; j < n - 1; j++){
      if(alist[j] == 1 && plus.length == 0){
        plus.push(j);
      }
      if(alist[j] == -1 && minus.length == 0){
        minus.push(j);
      }
    }
    //myerr(plus);
    //myerr(minus);
    var isOK = true;
    for(var j = n - 1; j > 0; j--){
      if(blist[j] > alist[j]){
        if(plus.length == 0 || plus[0] >= j){
          isOK = false;
        }
      }else if(blist[j] < alist[j]){
        if(minus.length == 0 || minus[0] >= j){
          isOK = false;
        }
      }
    }
    if(isOK){
      output[i] = "YES";
    }else{
      output[i] = "NO";
    }
  }
  myout(myconv(output,9));
}

function main(a, b) {
    var response = 'YES';
    if (a[0] !== b[0]) {
        response = 'NO'
    } else {
        var addPos = -1;
        var rmvPos = -1;
        for (var i = 0; i < a.length; i++) {
            if(a[i] === 1 && addPos === -1 ) {
                addPos = i;
            }
            if(a[i] === -1 && rmvPos === -1 ) {
                rmvPos = i;
            }

            if (addPos !== -1 && rmvPos !== -1) {
                break;
            }
        }

        for (var i = 1; i < b.length; i++) {
            if (b[i] !== a[i]) {
                if(b[i] > a[i]) {
                    if(addPos === -1) {
                        response = 'NO';
                        break;
                    }
                    if(addPos >= i) {
                        response = 'NO';
                        break;
                    }
                }
                if(b[i] < a[i]) {
                    if(rmvPos === -1) {
                        response = 'NO';
                        break;
                    }
                    if(rmvPos >= i) {
                        response = 'NO';
                        break;
                    }
                }
            }
        }
    }

    return response;
}

var n = readline();
var input = [];
var outputB = '';

var a
while (1===1) {
    t = readline();
    if(!t) {
        break;
    }
    a = readline().split(' ');
    b = readline().split(' ');

    for(var z = 0; z < t; z++) {
        a[z] = +a[z];
        b[z] = +b[z];
    }

    outputB += main(a, b) + '\n';
}

print(outputB);

for (var l = 0; l < parseInt(readline());l++)
{
	var size = parseInt(readline())
	var a = readline().split(' ').map(c => parseInt(c))
	var b = readline().split(' ').map(c => parseInt(c))
	var flag = true
	var one = a.indexOf(1), minus_one = a.indexOf(-1)
	for(var i = size-1; i>-1;i--){
		if (a[i] != b[i]){
			var check = b[i]-a[i]
			if (check < 0){
				if (minus_one == -1 || minus_one >= i){
					print('No')
					flag = false
					break
				}
			}
			else{
				if (one == -1 || one >= i){
					print('No')
					flag = false
					break
				}
			}
		}
	}
	if (flag){
		print('Yes')
	}
}

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
//atcoderのサンプルは最後に改行入れること
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
    var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var n = nextInt();
    var alist = nextIntArray();
    var blist = nextIntArray();
    if(alist[0] != blist[0]){
      output[i] = "NO";
      continue;
    }
    //右から確定したい
    //jより左に欲しいものがあるか
    //b[j]>a[j]なら1、b[j]>a[j]なら-1があってほしい
    var plus = [];
    var minus = [];
    for(var j = 0; j < n - 1; j++){
      if(alist[j] == 1 && plus.length == 0){
        plus.push(j);
      }
      if(alist[j] == -1 && minus.length == 0){
        minus.push(j);
      }
    }

    var isOK = true;
    for(var j = n - 1; j > 0; j--){
      if(blist[j] > alist[j]){
        for(var k = 0; k < plus.length; k++){
          if(plus[k] >= j){
            isOK = false;
            break;
          }
        }
      }else if(blist[j] < alist[j]){
        for(var k = 0; k < minus.length; k++){
          if(minus[k] >= j){
            isOK = false;
            break;
          }
        }
      }
    }
    if(isOK){
      output[i] = "YES";
    }else{
      output[i] = "NO";
    }
  }
  myout(myconv(output,9));
}

var n = readline();
var input = [];
var outputB = '';

while (1===1) {
    outputB += readline();
    outputB += readline();
    outputB += readline();
    if(!readline()) {
        break;
    }
}

print(outputB);


You are given an array $$$a_1, a_2, \ldots, a_n$$$ of positive integers. A good pair is a pair of indices $$$(i, j)$$$ with $$$1 \leq i, j \leq n$$$ such that, for all $$$1 \leq k \leq n$$$, the following equality holds:$$$$$$ |a_i - a_k| + |a_k - a_j| = |a_i - a_j|, $$$$$$ where $$$|x|$$$ denotes the absolute value of $$$x$$$.Find a good pair. Note that $$$i$$$ can be equal to $$$j$$$.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the length of the array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) where $$$a_i$$$ is the $$$i$$$-th element of the array. The sum of $$$n$$$ for all test cases is at most $$$2 \cdot 10^5$$$.

For each test case, print a single line with two space-separated indices $$$i$$$ and $$$j$$$ which form a good pair of the array. The case $$$i=j$$$ is allowed. It can be shown that such a pair always exists. If there are multiple good pairs, print any of them.

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

const EPS = 1e-6;

function main() {
    let T = +readline();
    while (T--){
      let n = +readline();
      let arr = readline().split(' ').map(a=>+a);
      let minI = -1, maxI = -1;
      for (let i=0; i<n; i++){
        if (minI==-1 || arr[minI]<arr[i])
          minI = i;
        if (maxI==-1 || arr[maxI]>arr[i])
          maxI = i;
      }
      print(minI+1, maxI+1)
    }
}

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

'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 arr = readline().split(' ').map(Number);

        let max = -Infinity;
        let min = Infinity;
        let maxIndex = -1;
        let minIndex = -1;
        for (let i = 0; i < n; i++) {
            if (arr[i] > max) {
                max = arr[i];
                maxIndex = i;
            }
            if (arr[i] < min) {
                min = arr[i];
                minIndex = i;
            }
        }

        output(`${maxIndex + 1} ${minIndex + 1}`);
    }
}

const fs = require('fs')
const inputs = fs.readFileSync(0, 'utf-8').split('\n')
const n = Number(inputs[0])
inputs.shift()
main(n, inputs)
function main(n, inputs) {
  for (let i = 0; i < n; i++) {
    const m = Number(inputs[i * 2]),
      data = inputs[i * 2 + 1].split(' ').map(Number)
    let min = 0,
      max = 0
    for (let j = 0; j < m; j++) {
      const num = data[j]
      if (num < data[min]) min = j
      if (num > data[max]) max = j
    }
    console.log(min + 1, max + 1)
  }
}

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

const EPS = 1e-6;

function main() {
    let T = +readline();
    while (T--){
      let n = +readline();
      let arr = readline().split(' ').map(a=>+a);
      print('1 1')
    }
}

let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var n = lines[0];
    var e = 0;
    for(j = 1; j <= n; j++){
        var k = lines[j].split('').map(Number);
        var a = 0;
        var b = 0;
        for(i = 0; i < 6; i++){
            if(i >= 3){
                a += k[i];
            }else{
                b += k[i];
            }
        }
        if(a == b){
            console.log('YES');
        }else{
            console.log('NO');
        }
    }
});

'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 arr = readline().split(' ').map(Number);
        output('1 1');
    }
}


Bob is a competitive programmer. He wants to become red, and for that he needs a strict training regime. He went to the annual meeting of grandmasters and asked $$$n$$$ of them how much effort they needed to reach red."Oh, I just spent $$$x_i$$$ hours solving problems", said the $$$i$$$-th of them. Bob wants to train his math skills, so for each answer he wrote down the number of minutes ($$$60 \cdot x_i$$$), thanked the grandmasters and went home. Bob could write numbers with leading zeroes — for example, if some grandmaster answered that he had spent $$$2$$$ hours, Bob could write $$$000120$$$ instead of $$$120$$$.Alice wanted to tease Bob and so she took the numbers Bob wrote down, and for each of them she did one of the following independently:   rearranged its digits, or  wrote a random number. This way, Alice generated $$$n$$$ numbers, denoted $$$y_1$$$, ..., $$$y_n$$$.For each of the numbers, help Bob determine whether $$$y_i$$$ can be a permutation of a number divisible by $$$60$$$ (possibly with leading zeroes).

The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 418$$$) — the number of grandmasters Bob asked. Then $$$n$$$ lines follow, the $$$i$$$-th of which contains a single integer $$$y_i$$$ — the number that Alice wrote down. Each of these numbers has between $$$2$$$ and $$$100$$$ digits '0' through '9'. They can contain leading zeroes.

Output $$$n$$$ lines. For each $$$i$$$, output the following. If it is possible to rearrange the digits of $$$y_i$$$ such that the resulting number is divisible by $$$60$$$, output "red" (quotes for clarity). Otherwise, output "cyan".

NoteIn the first example, there is one rearrangement that yields a number divisible by $$$60$$$, and that is $$$360$$$.In the second example, there are two solutions. One is $$$060$$$ and the second is $$$600$$$.In the third example, there are $$$6$$$ possible rearrangments: $$$025$$$, $$$052$$$, $$$205$$$, $$$250$$$, $$$502$$$, $$$520$$$. None of these numbers is divisible by $$$60$$$.In the fourth example, there are $$$3$$$ rearrangements: $$$228$$$, $$$282$$$, $$$822$$$.In the fifth example, none of the $$$24$$$ rearrangements result in a number divisible by $$$60$$$.In the sixth example, note that $$$000\dots0$$$ is a valid solution.

function main () {
  var n = parseInt(readline());
  while (n-- > 0) {
    print(solve(readline()));
  }

}

function solve (s) {
  var sum = 0;
  var countEven = false;
  var countZero = 0;

  for (var i = 0; i < s.length; i++) {
    var num = parseInt(s[i]);

    if (num === 0) countZero++;
    else if (!(num & 1)) countEven++;

    sum += num;
  }

  if (sum % 3 == 0 && (countZero > 1 || (countZero == 1 && countEven)))
    return "red";

  return "cyan";
}

main();

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

let arr = [];

readline.on("line", line => {
  arr.push(line);
});

readline.on("close", _ => {
  arr.shift();
  main();
});

const main = () => {
  arr.forEach(e => {
    const splitArr = e
      .toString()
      .split("")
      .map(Number);
    const nr0 = splitArr.filter(e => e === 0).length;
    if (
      splitArr.reduce((a, b) => a + b) % 3 === 0 &&
      nr0 >= 1 &&
      (splitArr.some(e => [2, 4, 6, 8].includes(e)) || nr0 >= 2)
    ) {
      console.log("red");
    } else {
      console.log("cyan");
    }
  });
};

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

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

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

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

  const n = parseInt(arr.shift())

  for(let j = 0; j < n; j++) {
    const num = arr[j]
    let d10 = false, d4 = false, even = false

    let len = num.length
    let sum = 0

    for(let i = 0; i < len; i++) {
      let x = parseInt(num[i])
      sum += x
      // console.log(sum, x, x % 2)
      if(x % 2 == 0 && d10) d4 = true
      if(x % 2 == 0 && x != 0) even = true
      if(num[i] == '0') {
        d10 = true
        if(even) d4 = true
      }
    }

    // console.log(d10, d4)
    if(sum % 3 == 0 && d10 && d4) {
      write('red')
    }
    else {
      write('cyan')
    }
  }
})

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

let index = 0;

function permut(string) {
  if (string.length < 2) return string;

  var permutations = [];
  for (var i = 0; i < string.length; i++) {
    var char = string[i];

    if (string.indexOf(char) != i)
      continue;

    var remainingString = string.slice(0, i) + string.slice(i + 1, string.length);

    for (var subPermutation of permut(remainingString))
      permutations.push(char + subPermutation)
  }
  return permutations;
}

readline.on('line', line => {
  if (index++) {
    let sol = "cyan";
    let sum = 0, even = false, zero = false;
    for(let i = 0; i < line.length; i++) {
      let c = Number(line[i]);
      if (!zero && c === 0) { zero = true; continue; }
      if (!even && c % 2 === 0) even = true;
      sum += c
    }
    if (zero && even && sum % 3 === 0) sol = "red";
    return console.log(sol);
  }
});

// readline.on("close", () => {
//   console.log(count, values);
// });


Let's define $$$S(x)$$$ to be the sum of digits of number $$$x$$$ written in decimal system. For example, $$$S(5) = 5$$$, $$$S(10) = 1$$$, $$$S(322) = 7$$$.We will call an integer $$$x$$$ interesting if $$$S(x + 1) < S(x)$$$. In each test you will be given one integer $$$n$$$. Your task is to calculate the number of integers $$$x$$$ such that $$$1 \le x \le n$$$ and $$$x$$$ is interesting.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — number of test cases. Then $$$t$$$ lines follow, the $$$i$$$-th line contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) for the $$$i$$$-th test case.

Print $$$t$$$ integers, the $$$i$$$-th should be the answer for the $$$i$$$-th test case.

NoteThe first interesting number is equal to $$$9$$$.

process.stdin.resume()
process.stdin.setEncoding('utf-8')
let standardInputString=''
let currentLine=0
function readline(){
    return standardInputString[currentLine++]
}
process.stdin.on('data',rawData=>{
    standardInputString+=rawData
})
process.stdin.on('end',_=>{
        standardInputString= standardInputString.trim().split('\n').map(line=>{
        return line.trim()
})
        main()
})
input=()=>parseInt(readline().trim())
print=(val)=>console.log(val)
sort=(arr)=> arr.sort((a,b)=>a-b)
Rsort=(arr)=> arr.sort((a,b)=>b-a)
StringListInput=()=> readline().trim().split(' ')
listInput=()=> readline().trim().split(' ').map(x=>parseInt(x))
Max=(arr)=> Math.max.apply(null,arr)
Min=(arr)=> Math.min.apply(null,arr)
function main(){
    let t = Number(readline());
    for (let i = 0; i < t;i++) {
        n = Number(readline());
        console.log(parseInt((n+1)/10));
    }
}

const fs = require('fs');

const stdin = String(fs.readFileSync(0));

const f = (n) => Math.floor((n + 1) / 10);

const out = stdin
  .split('\n')
  .slice(1)
  .map((nStr) => {
    const n = parseInt(nStr);

    return f(n);
  });

out.forEach((x) => {
  if (typeof x === 'number' && !Number.isNaN(x)) {
    console.log(x);
  }
});

"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() {
  // your code goes here
  let t = parseInt(readline());
let lst = [];
while (t--) {
  let res = 0;
  let input = parseInt(readline()); // changeable
  res = Number.parseInt(input / 10);
  let str = String(input);
  if (str[str.length - 1] == "9") {
    res += 1;
  }
  lst.push(res);
}
for (let val of lst) {
  console.log(val);
}

}

function solve(num) {
    console.log(Math.floor((num - 9) / 10) + 1);
}

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');
    const dataArr = input.slice(1).map(n => parseInt(n));
    const len = dataArr.length;

    for (let i = 0; i < len; i++) {
        solve(dataArr[i]);
    }
    process.exit();
});

let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var t = lines[0];
    var e = 0;
    for(i = 1; i <= t; i++){
        var k = lines[i];
        var ans = Math.floor(k / 10);
        ans += k % 10 == 9 ? 1 : 0;
        console.log(ans);
    }
});

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++){
		let n = nl.num();
		ans.push(Math.trunc((n + 1) / 10));
	}
	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 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 output = Math.floor(N / 10);
		if(N % 10 == 9){
			output++;
		}
		myout(output);
	}
}

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

var currentLine = 0;
var inputString = "";

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

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

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

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

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

  for (let i = 0; i < t; i++) {
    const n = +input();
    console.log(Math.floor((n + 1) / 10));
  }
}

// Input handling (Ctrl-D for EOF)

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

const input = [];
let currLine = 0;

rl.on("line", line => {
    input.push(line);
});

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

function readline() {
    return input[currLine++];
}

// Main function

function main() {
    const T = parseInt(readline());
    for (let t = 0; t < T; t++) {
        const N = parseInt(readline());
        console.log(Math.floor((N+1)/10));
    }
}

const lines = parseInt(readline());

Array(lines).fill(0).forEach(() => {
  const n = parseInt(readline());

  print(Math.floor(n / 10) + (n % 10 >= 9 ? 1 : 0));
});

var t=Number(readline());
for (var i=0;i<t;i++){
	var n=Number(readline());
	print(parseInt((n+1)/10))
}

t=+readline()
while(t--){
    n=+readline()+1
    print((n/10)|0)
}

for (var t = Number (readline ()); t > 0; t--)
    {
    print (Math.floor ((Number (readline ()) + 1) / 10));
    }

var t=Number(readline());
for (var i=0; i<t; i++) {
    var n=Number(readline());
    print(Math.floor((n+1)/10));
}

var n = parseInt(readline());

for (var i = 0; i < n; i++) {
    var res;
   var num = readline();
   if (num >= 9) {
       res = Math.floor(num / 10);
       if (num % 10 === 9) {
           res++;
       }
   } else {
       res = 0;
   }

   print(res);
}

var input = readline();
for(var i = 0; i < input; i ++) {
    var num = +readline();
    var result = Math.floor((num + 1) / 10);
    print(result);
}

const fs = require('fs');

const stdin = String(fs.readFileSync(0));

const f = (n) => Math.floor((n + 1) / 10);

const out = stdin
  .split('\n')
  .slice(1)
  .map((nStr) => {
    const n = parseInt(nStr);

    if (typeof n === 'number') {
      return f(n);
    } else {
      return '';
    }
  })
  .join('\n');

console.log(out);

const fs = require('fs');

const stdin = String(fs.readFileSync(0));

const out = stdin
  .split('\n')
  .slice(1)
  .map((n) => Math.floor((parseInt(n) + 1) / 10))
  .join('\n');

console.log(out);

"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() {
  let res = 0;
let input = readline(); // changeable
res = Number.parseInt(input / 10);
let str = String(input);
if (str[str.length - 1] == "9") {
  res += 1;
}
console.log(res);
}

function S(x) {
  return String(x).split('').reduce((acc, i) => acc + +i, 0);
}

var n = parseInt(readline());
var l = Array();

for (var x = 1; x <= n; x++) {
  if (S(x + 1) < S(x)) l.push(x);
}

print(l.join(' '));

function S(x) {
  return String(x).split('').reduce((acc, i) => acc + +i, 0);
}

var n = readline();
var l = Array();

for (var x = 1; x <= n; x++) {
  if (S(x + 1) < S(x)) l.push(x);
}

print(l.join(' '));

function S(x) {
  return String(x).split('').reduce((acc, i) => acc + +i, 0);
}

var n = readline();

for (var x = 1; x <= n; x++) {
  if (S(x + 1) < S(x)) print(x);
}

function S(x) {
  return String(x).split('').reduce((acc, i) => acc + +i, 0);
}

var n = readline();

for (var x = 1; x <= n; x++) {
  if (S(x + 1) < S(x)) print(count);
}

function S(x) {
  return String(x).split('').reduce((acc, i) => acc + +i, 0);
}

var n = readline();

var count = 0;

for (var x = 1; x <= n; x++) {
  if (S(x + 1) < S(x)) count++;
}

print(count);

function S(x) {
  return 1 <= x && x <= x;
}

var n = readline();

var count = 0;

for (var x = 1; x <= n; x++) {
  if (S(x + 1) < S(x)) count++;
}

print(count);


You are given a positive integer $$$x$$$. Check whether the number $$$x$$$ is representable as the sum of the cubes of two positive integers.Formally, you need to check if there are two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b$$$) such that $$$a^3+b^3=x$$$.For example, if $$$x = 35$$$, then the numbers $$$a=2$$$ and $$$b=3$$$ are suitable ($$$2^3+3^3=8+27=35$$$). If $$$x=4$$$, then no pair of numbers $$$a$$$ and $$$b$$$ is suitable.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case contains one integer $$$x$$$ ($$$1 \le x \le 10^{12}$$$). Please note, that the input for some test cases won't fit into $$$32$$$-bit integer type, so you should use at least $$$64$$$-bit integer type in your programming language.

For each test case, output on a separate line:    "YES" if $$$x$$$ is representable as the sum of the cubes of two positive integers.  "NO" otherwise.  You can output "YES" and "NO" in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive).

NoteThe number $$$1$$$ is not representable as the sum of two cubes.The number $$$2$$$ is represented as $$$1^3+1^3$$$.The number $$$4$$$ is not representable as the sum of two cubes.The number $$$34$$$ is not representable as the sum of two cubes.The number $$$35$$$ is represented as $$$2^3+3^3$$$.The number $$$16$$$ is represented as $$$2^3+2^3$$$.The number $$$703657519796$$$ is represented as $$$5779^3+7993^3$$$.

var c = new Set(), i, t, x, m, f, r = readline;
for (i = 1; i <= 1e4; i++)
  c.add(i * i * i);

t = parseInt(r());
while (t--) {
  x = parseInt(r());
  m = Math.ceil(Math.cbrt(x));
  f = false;
  for (i = 1; i <= m && !f; i++)
    if (c.has(x - i * i * i))
      f = true;
  print(f? 'yes': 'no');
}

var c = new Set(), i, t, x, m, f, r = readline;
for (i = 1; i <= 1e4; i++)
  c.add(i * i * i);

t = r();
while (t--) {
  x = r();
  m = Math.ceil(Math.cbrt(x));
  f = false;
  for (i = 1; i <= m && !f; i++)
    if (c.has(x - i * i * i))
      f = true;
  print(f? 'yes': 'no');
}

var c = new Set();

for (var i = 1; i <= 1e4; i++)
  c.add(i * i * i);

const t = readline();

for (var _ = 0; _ < t; _++) {
  var x = readline();
  var f = false;
  for (i of c)
    if (c.has(x - i)) {
      f = true;
      break;
    }
  print(f? 'yes': 'no');
}

var c=new Set(),i,t,x,f,r=readline
for(i=1;i<=1e4;i++)c.add(i*i*i)
t=r()
while(t--){x=r()
f=1
for(i of c)if(c.has(x-i)){f=0;break}
print(f?'no':'yes')}

var c=new Set(),i,t,x,f,r=readline,p=print
for(i=1;i<=1e4;i++)c.add(i*i*i)
t=r()
while(t--){x=r()
f=1
for(i of c)if(c.has(x-i)){f=0;break}
print(f?'no':'yes')}

var c=new Set(),i,t,x,f,r=readline
for(i=1;i<=1e4;i++)c.add(i*i*i)
t=r()
while(t--){x=r()
f=1
for(i=1;i*i*i<=x&&f;i++)if(c.has(x-i*i*i))f=0
print(f?'no':'yes')}

var c=new Set(),i,t,x,f,r=readline
for (i=1;i<=1e4;i++)
  c.add(i*i*i);
t=r()
while(t--){
  x=r()
  f=1
  for(i=1;i*i*i<=x&&f;i++)
    if(c.has(x-i*i*i))
      f=0
  print(f?'no':'yes')
}

var c=new Set(),i,t,x,max,f,r=readline
for (i=1;i<=1e4;i++)
  c.add(i*i*i);
t=parseInt(r())
while(t--){
  x=parseInt(r())
  max=Math.ceil(Math.cbrt(x))
  f=0
  for(i=1;i<=max&&!f;i++)
    if(c.has(x-i*i*i))
      f=1
  print(f?'yes':'no')
}

var c=new Set(),i,t,x,max,f
for (i=1;i<=1e4;i++)
  c.add(i*i*i);
t=parseInt(readline())
while(t--){
  x=parseInt(readline())
  max=Math.ceil(Math.cbrt(x))
  f=0
  for (i=1;i<=max&&!f;i++)
    if (c.has(x-i*i*i))
      f=1
  print(f?'yes':'no')
}

var cubes = new Set();

for (var i = 1; i <= 1e4; i++)
  cubes.add(i * i * i);

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var x = parseInt(readline());
  var max = Math.ceil(Math.cbrt(x));
  var f = false;
  for (var a = 1; a <= max && !f; a++)
    if (cubes.has(x - a * a * a))
      f = true;

  print(f? 'yes': 'no');
}

var row = readline().split(" ").map(function(x) { return parseInt(x); });
while(true) {
    var read = readline();
    if(read == undefined) break;
    var row = read.split(" ").map(function(x) { return parseInt(x); });

    var total = row[0];
    var a = 1;
    var flag = false;
    if (total > 1) {
        while(Math.pow(a, 3) < total) {
            var remain = total - a*a*a;
            var raw = Math.pow(remain, 1/3);
            var round = Math.round(raw);
            if(Math.pow(round, 3) == remain && round % 1 === 0) {
                flag = true;
                break;
            }
            a++;
        }
    }
    if(flag)
        write("YES" + "\n");
    else
        write("NO" + "\n");
}

tt = +readline()
while (tt!==0){
    flag = false
    tt--
    n = +readline()
    for (var a=1; a*a*a<=n; a++){
        var b = n - a*a*a
        var B = Math.round(Math.cbrt(b))
        if (B>0 && b==B*B*B){
            flag = true
            break
        }
    }
    if (flag){print('YES')}
    else{print('NO')}
}

var limit = parseInt(readline());
var input = new Array();
for (var i = 0; i < limit; i++) {
    input[i] = parseInt(readline());
}
var output = calc(input);
output.forEach(function (value) {
    print(value);
});
function calc(inputArray) {
    var result = new Array();
    for (var _i = 0, inputArray_1 = inputArray; _i < inputArray_1.length; _i++) {
        var element = inputArray_1[_i];
        if (element > 1) {
            var cubeRootNum = calcCubeRoot(element);
            var flag = false;
            for (var j = 1; j <= cubeRootNum; j++) {
                flag = calcSecondCube(j, element);
                if (flag)
                    break;
            }
            if (flag) {
                result.push("YES");
            }
            else {
                result.push("NO");
            }
        }
        else
            result.push("NO");
    }
    return result;
}
function calcCubeRoot(input) {
    var num = Math.cbrt(input);
    return Math.floor(num);
}
function calcSecondCube(first, element) {
    var different = element - first * first * first;
    if (different > 0) {
        var second = Math.cbrt(different);
        return second % 1 === 0;
    }
    else
        return false;
}

var Case = parseInt( readline() );
while(Case--){
  var n = readline() ;
  var flag = false;
  for(var i = 1; i*i*i <= n; i++){
      var j = n - (i*i*i);
      var b = Math.round( Math.cbrt(j) );
      if(b && b*b*b == j){
          flag = true;
          break;
      }
  }
  if(flag) print("YES");
  else print("NO");
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

function main() {
    var xx = Number(readline())
    Array(Number(xx)).fill(1).map((t, i) => {

        var x = parseInt(readline())

        var flag = false
        for (var i = 1; i < 10000; i++) {
            var y = x - i * i * i

            if (y > 0) {
                var r = 10000
                var l = 0
                while (r > l + 1) {
                    var mid = Math.floor((r + l) / 2)
                    if (mid * mid * mid > y) r = mid
                    else l = mid
                }

                // console.log(l, r, y)
                if (l * l * l === y) flag = true
            }
        }
        console.log(flag ? 'YES' : 'NO')
        // for (int i = rt; i >=0; --i)
        // {
        //     if (binary_search(i,i,num))
        //     {
        //         flag=true;
        //         break;
        //     }
        // }

    })

}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

function main() {
    var xx = Number(readline())
    Array(Number(xx)).fill(1).map((t, i) => {

        var x = parseInt(readline())

        var flag = false
        for (var i = 1; i < 100000; i++) {
            var y = x - i * i * i
            var cub = Math.floor(Math.cbrt(y))
            // console.log(cub, y)
            if (y > 0 && cub * cub * cub === y) {
                // console.log(i, cub)
                flag = true
            }
            // console.log(Math.floor(Math.cbrt(i)))
            // if (y > 0n) {
            //     var r = 10000n
            //     var l = 0n
            //     while (r > l + 1n) {
            //         var mid = (r + l) / 2n
            //         if (mid * mid * mid >= y) r = mid
            //         else l = mid
            //     }
            //
            // console.log(l, r, y)
            // if (r*r*r === y) flag = true
            // }
        }
        console.log(flag ? 'YES' : 'NO')
        // for (int i = rt; i >=0; --i)
        // {
        //     if (binary_search(i,i,num))
        //     {
        //         flag=true;
        //         break;
        //     }
        // }

    })

}

function binary_search(num2, r, num, rr) {
    var mid;
    var l = r;
    r = num
    var value;
    // console.log(l, r)

    while (l <= r) {
        mid = ((l + r) / 2n);
        // Calculating mid.
        // console.log(mid * mid * mid + num2 * num2 * num2, num)
        value = mid * mid * mid + num2 * num2 * num2
        if ((value) === num) {

            return true;
        } else if ((value) > num) {
            r = mid - 1n;
        } else {
            l = mid + 1n;
        }
    }
    return false;
}

"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++];
}
let obj = {};
const precompute = () => {
  for (let i = 1; i <= 10000; i++) obj[i * i * i] = 1;
};
const solve = () => {
  let t = parseInt(readline());
  precompute();
  while (t--) {
    let n = parseInt(readline());
    for (let i = 1; i <= 10000; i++) {
      let j = n - i * i * i;
      if (j <= 0) {
        console.log("NO");
        break;
      }
      if (obj[j]) {
        console.log("YES");
        break;
      }
    }
  }
};
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++];
}

// Actual code...

function main() {
    const numCases = parseInt(readline());
    for (let i = 0; i < numCases; i++) {
        const target = parseInt(readline());
        const cubeRoot = Math.cbrt(target);
        let found = false;
        let a = 1;
        while (a < cubeRoot && !found) {
            const b = Math.cbrt(target - Math.pow(a, 3));
            if (Number.isInteger(b)) found = true;
            a++;
        }
        if (found) {
            console.log("YES");
        } else {
            console.log("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{
			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 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 isOK = false;
		for(var j = 1; j <= 10000; j++){
			if(Math.cbrt(N - j * j * j) % 1 == 0 && (N - j * j * j) > 0){
				isOK = true;
			}
		}
		myout((isOK) ? "YES" : "NO");
	}
}

input()
//-------------------

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

}

function solve (arr) {
  var d =+arr[0]

  for (var i =1 ; i <=d ;i++){
    console.log(test(+arr[i]))
  }

}

function test(num ){

  var Max =10000
  var mas =[]

  var k =1
  while (k <=Max){

    mas.push(k*k*k)
    k++
  }
  var mno =new Set(mas)

  for (var a of mas){
    if (2*a > num) break;
    if (mno.has(num - a)) {
      //console.log(num,Math.cbrt(a),Math.cbrt(num -a) )
      return "YES"

    }
  }
  return "NO"

}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let arr = [];
rl.on('line', line => {
    arr.push(Number(line));
})
rl.on('close', line => {
    var map = new Map();
    for (var i = 1; i * i * i <= 10 ** 12; i++) {
        map.set(i * i * i, i);
    }
    for (var i = 1; i < arr.length; i++) {
        var target = arr[i];
        var flag = false;
        for (var j = 1; j * j * j < target; j++) {
            if (map.has(target - j * j * j)) {
                flag = true;
                break;
            }
        }
        if (flag) {
            console.log("YES");
        } else {
            console.log("NO");
        }
    }
})

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

let input = [];

rl.on("line", (ln) => {
  input.push(ln);
}).on("close", () => {
  const T = input.shift();

  for (let i = 0; i < T; i++) {
    const num = Number(input.shift());
    const limit = Math.floor(Math.pow(num, 1 / 3));
    let start = 1;
    let end = limit;

    let ans = "NO";
    while (start <= end && end <= limit) {
      let sum = Math.pow(start, 3) + Math.pow(end, 3);
      if (sum === num) {
        ans = "YES";
        break;
      }
      if (sum > num) {
        end--;
        continue;
      }
      if (sum < num) {
        start++;
        continue;
      }
    }
    console.log(ans);
  }
});

let lines = require('fs').readFileSync(global.FILE_DESCRIPTOR || 0).toString().split('\n');
let index = 0;
const readline = () => lines[index++] || '';

let n = +readline();
for (let i = 0; i < n; i++) {
  (function () {
    let num = +readline();
    let aaa = Math.cbrt(num);
    for (let j = 1; j < aaa; j++) {
      if (Math.cbrt(num - Math.pow(j, 3)) % 1 === 0) {
        return console.log('YES')
      }
    }
    console.log('NO')
  })();
}

/*
 * File Created: Tuesday, 16th February 2021 3:32:09 pm
 * Author: Lukas Rimkus
 */

 'use-strict'

const { count } = require("console");

 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(data.shift());

     while(testCases--) {

        const x = BigInt(readLine());

        // const arr = readLine().split(' ').map(Number);

        const res = c(x);

        console.log(res)
     }
 });

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

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

 function a(n,arr){
     let count = 0;
     for(let i = 0 ; i < n - 1; i++){
         let max = Math.max(arr[i], arr[i+1]);
         let min = Math.min(arr[i], arr[i+1]);
         if(max/min > 2){
             while(min * 2 < max){
                 max = max / 2;
                 count++;
             }
         } else{
             continue;
         }
     }
     return count;
 }

 function b(n,arr){
     let c0 = 0;
     let c1 = 0;
     let c2 = 0;
     let count = 0;
     for(let i = 0 ; i < n ; i++){
         if(arr[i] % 3 === 0){
             c0++;
         } else if(arr[i] % 3 === 1){
             c1++;
         } else if(arr[i] % 3 === 2){
             c2++;
         }
     }

     while(c1 !== n / 3 || c2 !== n / 3 || c1 !== n / 3){
        //  console.log(`${c0},${c1}, ${c2}`)
        if(c0 > n / 3){
            let free0 = c0 - n/3;
            while(free0 > 0){

                if(c1 < n / 3){
                    free0--;
                    c1++;
                    count+=1;
                    c0--;
                }
                if(c2 < n /3){
                    free0--;
                    c2++;
                    count+=2;
                    c0--;
                }
            }
        }
        if(c1 > n / 3){
            let free1 = c1 - n/3;
            while(free1 > 0){
                if(c2 < n / 3){
                    free1--;
                    c2++;
                    count += 1;
                    c1--;
                }
                if(c0 < n / 3){
                    free1--;
                    c0++;
                    count += 2;
                    c1--;
                }
            }
        }
        if(c2 > n/3){
            let free2 = c2 - n / 3;
            // console.log(`${free2}, ${c0}, ${c1}, ${c2}, ${n}`)
            while(free2 > 0){

                if(c0 < n / 3){
                    free2--;
                    c0++;
                    count += 1;
                    c2--;
                }
                if(c1 < n/3){
                    free2--;
                    c1++;
                    count += 2;
                    c2--;
                }
            }
        }
     }
     return count;

 }

 function c(x){
    for(let i = 1; i < 10001; i++){
        if(Math.cbrt(Number(x) - i * i * i) % 1 == 0 && (Number(x) - i * i * i) > 0){
            return 'YES'
        }
    }
    return 'NO';
}

 module.exports = c

var c=new Set(),i,t,x,f,r=readline,p=print
for(i=1;i<=1e4;i++)c.add(i*i*i)
t=r()
while(t--){x=r()
f=1
for(i of c)if(c.has(x-c)){f=0;break}
print(f?'no':'yes')}

var c=new Set(),i,t,x,f,r=readline,z
for (i=1;i<=1e4;i++)
  c.add(i*i*i);
t=r()
while(t--){
  x=r()
  f=1
  for(i=1;z=i*i*i<=x&&f;i++)
    if(c.has(x-z))
      f=0
  print(f?'no':'yes')
}

var c=new Set(),i,t,x,f,r=readline,z
for(i=1;i<=1e4;i++)c.add(i*i*i)
t=r()
while(t--){x=r()
f=1
for(i=1;z=i*i*i<=x&&f;i++)if(c.has(x-z))f=0
print(f?'no':'yes')}

const cube = () => {
  var cache = new Set();
  return (a) => {
    if (cache.has(a)) {
      return true;
    } else {
      cache.add(a * a * a);
      return false;
    }
  }
}

const memo_cube = cube();

for (var i = 1; i <= 1e4; i++)
  memo_cube(i)

const t = parseInt(readline());
// const t = 1;

for (var _ = 0; _ < t; _++) {
  var x = parseInt(readline());
  // var x = 703657519796;
  var max = Math.ceil(Math.cbrt(x));
  var f = false;
  for (var a = 1; a <= max && !f; a++)
    if (memo_cube(x - a * a * a))
      f = true;

  print(f? 'yes': 'no');

}

const cube = () => {
  var cache = {};
  return (a) => {
    if (a in cache) {
      return cache[a];
    } else {
      const c = Math.pow(a, 3);
      cache[a] = c;
      return c;
    }
  }
}

const memo_cube = cube();

const has_cubic_sum = () => {
  var cache = {};
  return (x) => {
    if (x in cache) {
      return cache[x];
    } else {
      var max = Math.ceil(Math.cbrt(x));
      var f = false;
      for (var a = 1; a <= max && !f; a++)
        for (var b = a; b <= max && !f; b++)
          if (memo_cube(a) + memo_cube(b) == x)
            f = true;

      cache[x] = f;
      return f;
    }
  }
}

const memo_has_cubic_sum = has_cubic_sum();

const t = parseInt(readline());
// const t = 1;

for (var _ = 0; _ < t; _++) {
  var x = parseInt(readline());
  print(has_cubic_sum(x)? 'yes': 'no');
  // var x = 2;
  // console.log(memo_has_cubic_sum(x)? 'yes': 'no');
}

const cube = () => {
  var cache = {};
  return (a) => {
    if (cache[a] !== undefined) {
      return cache[a];
    } else {
      const c = Math.pow(a, 3);
      cache[a] = c;
      return c;
    }
  }
}

const memo_cube = cube();

const has_cubic_sum = () => {
  var cache = {};
  return (x) => {
    if (cache[x] !== undefined) {
      return cache[x];
    } else {
      var max = Math.ceil(Math.cbrt(x));
      var f = false;
      for (var a = 1; a <= max && !f; a++)
        for (var b = a; b <= max && !f; b++)
          if (memo_cube(a) + memo_cube(b) == x)
            f = true;

      cache[x] = f;
      return f;
    }
  }
}

const memo_has_cubic_sum = has_cubic_sum();

const t = parseInt(readline());
// const t = 1;

for (var _ = 0; _ < t; _++) {
  var x = parseInt(readline());
  print(has_cubic_sum(x)? 'yes': 'no');
  // var x = 2;
  // console.log(memo_has_cubic_sum(x)? 'yes': 'no');
}

const cube = () => {
  var cache = {};
  return (a) => {
    if (cache[a] !== undefined) {
      //console.log('Fetching from cache 1');
      return cache[a];
    } else {
      //console.log('Calculating result 1');
      const c = Math.pow(a, 3);
      cache[a] = c;
      return c;
    }
  }
}

const memo_cube = cube();

const has_cubic_sum = () => {
  var cache = {};
  return (x) => {
    if (cache[x] !== undefined) {
      console.log('Fetching from cache 2');
      return cache[x];
    } else {
      console.log('Calculating result 2');
      var max = Math.ceil(Math.cbrt(x));
      var f = false;
      for (var a = 1; a <= max && !f; a++)
        for (var b = a; b <= max && !f; b++)
          if (memo_cube(a) + memo_cube(b) == x)
            f = true;

      cache[x] = f;
      return f;
    }
  }
}

const memo_has_cubic_sum = has_cubic_sum();

const t = parseInt(readline());
// const t = 1;

for (var _ = 0; _ < t; _++) {
  var x = parseInt(readline());
  print(has_cubic_sum(x)? 'yes': 'no');
  // var x = 1;
  //console.log(memo_has_cubic_sum(x)? 'yes': 'no');
}

const cubic_sum = (a, b) => {
  var cache = {};
  return (a, b) => {
    const key = `${a} ${b}`;
    if (cache[key] !== undefined)
      return cache[key];
    else {
      const sum = Math.pow(a, 3) + Math.pow(b, 3);

      cache[key] = sum;
      return sum;
    }
  }
}

const has_cubic_sum = (x) => {
  var cache = {};
  return (x) => {
    if (cache[x] !== undefined)
      return cache[x];
    else {
      var max = Math.ceil(Math.cbrt(x));
      var f = false;
      for (var a = 1; a <= max && !f; a++)
        for (var b = a; b <= max && !f; b++)
          if (cubic_sum(a, b) == x)
            f = true;

      cache[x] = f;
      return f;
    }
  }
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var x = parseInt(readline());
  print(has_cubic_sum(x)? 'yes': 'no');
}

var row = readline().split(" ").map(function(x) { return parseInt(x); });
while(true) {
    var read = readline();
    if(read == undefined) break;
    var row = read.split(" ").map(function(x) { return parseInt(x); });

    var total = row[0];
    var a = 1;
    var flag = false;
    if (total > 1) {
        while(Math.pow(a, 3) <= total) {
            var remain = total - a*a*a;
            var raw = Math.pow(remain, 1/3);
            var round = Math.round(raw);
            if(Math.pow(round, 3) == remain && round % 1 === 0) {
                flag = true;
                break;
            }
            a++;
        }
    }
    if(flag)
        write("YES" + "\n");
    else
        write("NO" + "\n");
}

tt = +readline()
while (tt!==0){
    flag = false
    tt--
    n = +readline()
    for (var a=0; a*a*a<=n; a++){
        var b = n - a*a*a
        var B = Math.round(Math.cbrt(b))
        if (B>0 && b==B*B*B){
            flag = true
            break
        }
    }
    if (flag){print('YES')}
    else{print('NO')}
}

"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++];
}
let obj = {};
const precompute = () => {
  for (let i = 1; i <= 10000; i++) obj[i * i * i] = 1;
};
const solve = () => {
  let t = parseInt(readline());
  precompute();
  while (t--) {
    let n = parseInt(readline());
    for (let i = 0; i <= 10000; i++) {
      let j = n - i * i * i;
      if (j < 0) {
        console.log("NO");
        break;
      }
      if (obj[j]) {
        console.log("YES");
        break;
      }
    }
  }
};
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++];
}
let obj = {};
const precompute = () => {
  for (let i = 1; i <= 9999; i++) obj[i * i * i] = 1;
};
const solve = () => {
  let t = parseInt(readline());
  precompute();
  while (t--) {
    let n = parseInt(readline());
    for (let i = 1; i <= 9999; i++) {
      let j = n - i * i * i;
      if (j < 0) {
        console.log("NO");
        break;
      }
      if (obj[j]) {
        console.log("YES");
        break;
      }
    }
  }
};
solve();


Ilya is a very good-natured lion. He likes maths. Of all mathematical objects, his favourite one is matrices. Now he's faced a complicated matrix problem he needs to solve.He's got a square 2n × 2n-sized matrix and 4n integers. You need to arrange all these numbers in the matrix (put each number in a single individual cell) so that the beauty of the resulting matrix with numbers is maximum.The beauty of a 2n × 2n-sized matrix is an integer, obtained by the following algorithm:  Find the maximum element in the matrix. Let's denote it as m.  If n = 0, then the beauty of the matrix equals m. Otherwise, a matrix can be split into 4 non-intersecting 2n - 1 × 2n - 1-sized submatrices, then the beauty of the matrix equals the sum of number m and other four beauties of the described submatrices. As you can see, the algorithm is recursive.Help Ilya, solve the problem and print the resulting maximum beauty of the matrix.

The first line contains integer 4n (1 ≤ 4n ≤ 2·106). The next line contains 4n integers ai (1 ≤ ai ≤ 109) — the numbers you need to arrange in the 2n × 2n-sized matrix.

On a single line print the maximum value of the beauty of the described matrix. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

NoteConsider the second sample. You need to arrange the numbers in the matrix as follows:1 23 4Then the beauty of the matrix will equal: 4 + 1 + 2 + 3 + 4 = 14.

print(function(n, a) {

	var i, ans = 0;

	a.sort(function(a, b) {
		return b - a;
	});

	for (i = 1; i < n; i++)
		a[i] += a[i - 1];

	for (i = 1; i <= n; i *= 4)
		ans += a[i - 1];

	return ans;

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

print(function(n, a) {

	a.sort(function(a, b) {
		return b - a;
	});

	var sum = 0;
	var b =a.map(function(v) {
		return sum += v;
	});

	var ans = 0;
	for (var i = 1; i <= n; i *= 4) {
		ans += b[i - 1];
	}

	return ans;

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


Petya has a rectangular Board of size $$$n \times m$$$. Initially, $$$k$$$ chips are placed on the board, $$$i$$$-th chip is located in the cell at the intersection of $$$sx_i$$$-th row and $$$sy_i$$$-th column.In one action, Petya can move all the chips to the left, right, down or up by $$$1$$$ cell.If the chip was in the $$$(x, y)$$$ cell, then after the operation:   left, its coordinates will be $$$(x, y - 1)$$$;  right, its coordinates will be $$$(x, y + 1)$$$;  down, its coordinates will be $$$(x + 1, y)$$$;  up, its coordinates will be $$$(x - 1, y)$$$. If the chip is located by the wall of the board, and the action chosen by Petya moves it towards the wall, then the chip remains in its current position.Note that several chips can be located in the same cell.For each chip, Petya chose the position which it should visit. Note that it's not necessary for a chip to end up in this position.Since Petya does not have a lot of free time, he is ready to do no more than $$$2nm$$$ actions.You have to find out what actions Petya should do so that each chip visits the position that Petya selected for it at least once. Or determine that it is not possible to do this in $$$2nm$$$ actions.

The first line contains three integers $$$n, m, k$$$ ($$$1 \le n, m, k \le 200$$$) — the number of rows and columns of the board and the number of chips, respectively. The next $$$k$$$ lines contains two integers each $$$sx_i, sy_i$$$ ($$$ 1 \le sx_i \le n, 1 \le sy_i \le m$$$) — the starting position of the $$$i$$$-th chip. The next $$$k$$$ lines contains two integers each $$$fx_i, fy_i$$$ ($$$ 1 \le fx_i \le n, 1 \le fy_i \le m$$$) — the position that the $$$i$$$-chip should visit at least once.

In the first line print the number of operations so that each chip visits the position that Petya selected for it at least once. In the second line output the sequence of operations. To indicate operations left, right, down, and up, use the characters $$$L, R, D, U$$$ respectively. If the required sequence does not exist, print -1 in the single line.

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

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

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

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

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

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  const [n, m, k] = readInts()
  const coord = new Array(k)
  const pos = new Array(k)
  const diff = new Array(k)
  for(let i = 0; i < k; i++) {
    coord[i] = readInts()
  }
  for(let i = 0; i < k; i++) {
    pos[i] = readInts()
  }
  let map = {}
  let c = 0
  let s = ''
  for(let i = 0, l = 2 * n * m; i < l && c < k; i++) {
    for(let i = 0; i < k; i++) {
      diff[i] = [pos[i][0] - coord[i][0], pos[i][1] - coord[i][1], i, map[i] ? 1 : 0]
    }
    for(let i = 0; i < k; i++) {
      if(diff[i][0] === 0 && diff[i][1] === 0 && !map[diff[i][2]]) {
        map[diff[i][2]] = true
        diff[i][3] = 1
        c++
      }
    }
    if(c === k) break
    diff.sort(sortThis)
    // wr(diff)
    let curr = diff[0]
    let changX = curr[0]
    let changY = curr[1]
    let index = curr[2]
    for(let i = 0; i < k; i++) {
      if(changX < 0) coord[i][0] = Math.max(1, coord[i][0] + changX)
      else coord[i][0] = Math.min(n, coord[i][0] + changX)
      if(changY < 0) coord[i][1] = Math.max(1, coord[i][1] + changY)
      else coord[i][1] = Math.min(m, coord[i][1] + changY)
    }
    if(changX < 0) {
      s = s.padEnd(s.length - changX, 'U')
    }
    if(changX > 0) {
      s = s.padEnd(s.length + changX, 'D')
    }
    if(changY < 0) {
      s = s.padEnd(s.length - changY, 'L')
    }
    if(changY > 0) {
      s = s.padEnd(s.length + changY, 'R')
    }
  }
  if(c === k) {
    wr(s.length)
    wr(s)
  }
  else wr(-1)
}

function sortThis(a, b) {
  if(a[3] === 1) return 1
  else if(b[3] === 1) return -1
  if(a[0] !== b[0]) {
    if(a[0] <= 0 && b[0] <= 0) return b[0] - a[0]
    else return a[0] - b[0]
  }
  else {
    if(a[1] <= 0 && b[1] <= 0) return b[1] - a[1]
    else return a[1] - b[1]
  }
}

const mod =  998244353

const processData = (lines) => {
  let [n, m] = lines[0].split(' ').map(x => +x)
  const [x0, y0] = lines[1].split(' ')

  let d = n

  let res = [].concat(Array(n-1).fill('D')).concat(Array(m-1).fill('L'))

  let dirRight = true
  while(d) {
    res = res.concat(Array(m-1).fill(dirRight ? 'R' : 'L'))
    dirRight = !dirRight
    res.push('U')
    d--
  }

  console.log(res.length)
  console.log(res.join(''))
  // console.log(n, m)
  // let resMap = Array(n).fill(1).map(x => Array(m).fill(0))
  // let pos = [x0-1, y0-1]
  // resMap[pos[0]][pos[1]] = 1
  // for (const c of res) {
  //   switch(c) {
  //     case 'L':
  //       pos[0]--
  //       break
  //     case 'R':
  //       pos[0]++
  //       break
  //     case 'D':
  //       pos[1]--
  //       break
  //     case 'U':
  //       pos[1]++
  //       break
  //   }
  //   if (pos[0] < 0) {
  //     pos[0] = 0
  //   }
  //   if (pos[0] >= n) {
  //     pos[0] = n-1
  //   }
  //   if (pos[1] < 0) {
  //     pos[1] = 0
  //   }
  //   if (pos[1] >= m) {
  //     pos[1] = m-1
  //   }
  //   resMap[pos[0]][pos[1]] = 1
  // }
  // console.log(resMap)
}

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

const mod =  998244353

const processData = (lines) => {
  let [n, m] = lines[0].split(' ').map(x => +x)

  let res = [].concat(Array(n-1).fill('L')).concat(Array(m-1).fill('D'))

  let dirRight = true
  m--
  while(m) {
    res = res.concat(Array(n-1).fill(dirRight ? 'R' : 'L'))
    dirRight = !dirRight
    res.push('U')
    m--
  }

  console.log(res.length)
  console.log(res.join(''))
}

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

const mod =  998244353

const processData = (lines) => {
  let [n, m] = lines[0].split(' ').map(x => +x)

  let res = [].concat(Array(n).fill('L')).concat(Array(m).fill('D'))

  let dirRight = true
  while(m) {
    res = res.concat(Array(n).fill(dirRight ? 'R' : 'L'))
    dirRight = !dirRight
    res.push('U')
    m--
  }

  console.log(res.length)
  console.log(res.join(''))
}

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

const mod =  998244353

const processData = (lines) => {
  let [n, m] = lines[0].split(' ').map(x => +x)

  let res = [].concat(Array(n-1).fill('L')).concat(Array(m-1).fill('D'))

  let dirRight = true
  while(m) {
    res = res.concat(Array(n-1).fill(dirRight ? 'R' : 'L'))
    dirRight = !dirRight
    res.push('U')
    m--
  }

  console.log(res.length)
  console.log(res.join(''))
}

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