You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You should find all words in the given string that are nonnegative INTEGER numbers without leading zeroes and build by them new string a. String a should contain all words that are numbers separating them by ',' (the order of numbers should remain the same as in the string s). By all other words you should build string b in the same way (the order of numbers should remain the same as in the string s).Here strings "101", "0" are INTEGER numbers, but "01" and "1.0" are not.For example, for the string aba,123;1a;0 the string a would be equal to "123,0" and string b would be equal to "aba,1a".

The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.

Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.

NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".

var inputWords = [];
var separ = [',', ';'];
var inputRaw = readline();
inputWords = inputRaw.split(new RegExp(separ.join('|'), 'g'));

var numbers = "\"";
var nonNumbers = "\"";

for (i = 0; i < inputWords.length; i++)
{
    var reg = new RegExp('^[0-9]+$');
    if (reg.test(inputWords[i]))
    {
        if (inputWords[i].length > 1 && inputWords[i].charAt(0) == '0')
        {
            nonNumbers += inputWords[i] + ",";
        }
        else
        {
            numbers += inputWords[i] + ",";
        }
    }
    else
    {
        nonNumbers += inputWords[i] + ",";
    }
}

if (numbers.length === 1)
{
    numbers = "-";
}
else
{
    numbers = numbers.substr(0, numbers.length - 1);
    numbers += '\"';
}

if (nonNumbers.length === 1)
{
    nonNumbers = "-";
}
else
{
    nonNumbers = nonNumbers.substr(0, nonNumbers.length - 1);
    nonNumbers += '\"';
}

print (numbers);
print (nonNumbers);

readline().split(/,|;/).reduce((ab, word) => {
    if (!word || word.match(/^[0]+[0-9]+$/) || !word.match(/^\d+$/)) {
        ab[1].push(word);
    } else {
        ab[0].push(word);
    }
    return ab;
}, [[],[]])
.map(result => result.length > 0 ? "\"" + result.join(',') + "\"" : "-")
.forEach(result => print(result));

var inp = readline().split(/[,;]/g), n = inp.length;

var a = "", b = "";

for(var i = 0; i < n; i++){
    var str = inp[i];

    if(str === "") {b += str + ",";continue;}
    if(!/^\d+$/.test(str) && str != "0") { b += str + ","; continue; }
    if(/^0+/.test(str) && str != "0") { b += str + ","; continue; }
    a += str + ",";
}

if(a.length !== 0)
    print("\"" + a.substring(0, a.length - 1) + "\"");
else print("-");
if(b.length !== 0)
    print("\"" + b.substring(0, b.length - 1) + "\"");
else print("-");

const zeroCharCode = '0'.charCodeAt(0);

const numberMap = new Map([
  [ zeroCharCode, 0 ],
  [ '1'.charCodeAt(0), 1 ],
  [ '2'.charCodeAt(0), 2 ],
  [ '3'.charCodeAt(0), 3 ],
  [ '4'.charCodeAt(0), 4 ],
  [ '5'.charCodeAt(0), 5 ],
  [ '6'.charCodeAt(0), 6 ],
  [ '7'.charCodeAt(0), 7 ],
  [ '8'.charCodeAt(0), 8 ],
  [ '9'.charCodeAt(0), 9 ]
]);
const isNumber = (str, at) => numberMap.has(str.charCodeAt(at));
const isNumeric = (str) => {
  if(str.length < 1) {
    return false;
  }

  if(str.length === 1) {
    return isNumber(str, 0);
  }

  if (str.charCodeAt(0) === zeroCharCode) {
    return false;
  }

  for (let i = str.length - 1; i >= 0; i--) {
    if(!isNumber(str, i)) {
      return false;
    }
  }
  return true;
}

const processInput = input => {
  const wordList = input.split(/[;,]/);
  /*
    input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );
  */

  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumeric(word)) {
      a.push(word);
      return;
    }

    b.push(word);
  });

  process.stdout.write(a.length < 1 ?  '-' : `"${a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(b.length < 1 ?  '-' : `"${b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join('').trim());
    process.exit(0);
  });
})();

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

function findWord(word){
    let ch = 0, digit = 0;
    if (word.length === 0){
        return true;
    }
    for (let i = 0; i < Math.ceil(word.length / 2); i++){
        if (word[i] >= '0' && word[i] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
        if (word[word.length - i - 1] >= '0' && word[word.length - i - 1] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
    }
    if (ch === 0){
        return false;
    } else {
        return true;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false, ck = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if (x.length === 0)ck = true;
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0 && ck === false){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    rl.close();
})

var words = readline().split(/,|;/);
var s1 = [], s2 = [];
for(var x of words) {
	var n = ~~Number(x);
	if(String(n) === x && n >= 0) s1.push(x);
	else s2.push(x);
}

if(s1.length == 0) print("-");
else print('"' + s1.join(",") + '"');

if(s2.length == 0) print("-");
else print('"' + s2.join(",") + '"');

var words = readline().split(/,|;/);
var s1 = [], s2 = [];
for(var x of words) {
	var n = ~~+(x);
	if(String(n) === x && n >= 0) s1.push(x);
	else s2.push(x);
}

if(s1.length == 0) print("-");
else print('"' + s1.join(",") + '"');

if(s2.length == 0) print("-");
else print('"' + s2.join(",") + '"');

var inputWords = [];
var separ = [',', ';'];
var inputRaw = readline();
inputWords = inputRaw.split(new RegExp(separ.join('|'), 'g'));

var numbers = "\"";
var nonNumbers = "\"";

for (i = 0; i < inputWords.length; i++)
{
    var reg = new RegExp('^[0-9]+$');
    if (reg.test(inputWords[i]))
    {
        if (inputWords[i].length > 1 && inputWords[i].charAt(0) == '0')
        {
            nonNumbers += inputWords[i] + ",";
        }
        else
        {
            numbers += inputWords[i] + ",";
        }
    }
    else
    {
        nonNumbers += inputWords[i] + ",";
    }
}

if (numbers.length === 1)
{
    numbers += "-\"";
}
else
{
    numbers = numbers.substr(0, numbers.length - 1);
    numbers += '\"';
}

if (nonNumbers.length === 1)
{
    nonNumbers += "-\"";
}
else
{
    nonNumbers = nonNumbers.substr(0, nonNumbers.length - 1);
    nonNumbers += '\"';
}

print (numbers + "\n");
print (nonNumbers);

var inputWords = [];
var separ = [',', ';'];
var inputRaw = readline();
inputWords = inputRaw.split(new RegExp(separ.join('|'), 'g'));

var numbers = "\"";
var nonNumbers = "\"";

for (i = 0; i < inputWords.length; i++)
{
    var reg = new RegExp('^[0-9]+$');
    if (reg.test(inputWords[i]))
    {
        if (inputWords[i].length > 1 && inputWords[i].charAt(0) == '0')
        {
            nonNumbers += inputWords[i] + ",";
        }
        else
        {
            numbers += inputWords[i] + ",";
        }
    }
    else
    {
        nonNumbers += inputWords[i] + ",";
    }
}

if (numbers.length === 1)
{
    numbers += "-\"";
}
else
{
    numbers = numbers.substr(0, numbers.length - 1);
    numbers += '\"';
}

if (nonNumbers.length === 1)
{
    nonNumbers += "-\"";
}
else
{
    nonNumbers = nonNumbers.substr(0, nonNumbers.length - 1);
    nonNumbers += '\"';
}

print (numbers);
print (nonNumbers);

var inputWords = readline().split(",;");

var numbers;
var nonNumbers;

for (i = 0; i < inputWords.length; i++)
{
    var num = parseInt(inputWords[i]);
    if (typeof num === 'number')
    {
        var remainder = (num % 1);
        if (remainder === 0)
        {
            numbers += num + ",";
        }
        else
        {
            nonNumbers += num + "'";
        }
    }
}

print (numbers);
print (nonNumbers);

print("flavius");

var inputWords = [];
var separ = [',', ';'];
var inputRaw = readline();
inputWords = inputRaw.split(new RegExp(separ.join('|'), 'g'));

var numbers = "";
var nonNumbers = "";

for (i = 0; i < inputWords.length; i++)
{
    var reg = new RegExp('^[0-9]+$');
    if (reg.test(inputWords[i]))
    {
        if (inputWords[i].length > 1 && inputWords[i].charAt(0) == '0')
        {
            nonNumbers += inputWords[i] + ",";
        }
        else
        {
            numbers += inputWords[i] + ",";
        }
    }
    else
    {
        nonNumbers += inputWords[i] + ",";
    }
}

if (numbers.length === 0)
    numbers += "-";

if (nonNumbers.length === 0)
    nonNumbers += "-";

print (numbers + "\n");
print (nonNumbers);

var inputWords = [];
var separ = [',', ';'];
var inputRaw = readline();
inputWords = inputRaw.split(new RegExp(separ.join('|'), 'g'));

var numbers = "";
var nonNumbers = "";

for (i = 0; i < inputWords.length; i++)
{
    var reg = new RegExp('^[0-9]+$');
    if (reg.test(inputWords[i]))
    {
        if (inputWords[i].length > 1 && inputWords[i].charAt(0) == '0')
        {
            nonNumbers += inputWords[i] + ",";
        }
        else
        {
            numbers += inputWords[i] + ",";
        }
    }
    else
    {
        nonNumbers += inputWords[i] + ",";
    }
}

if (numbers.length == 0)
    numbers += "-";

if (nonNumbers.length == 0)
    nonNumbers += "-";

print (numbers + "\n");
print (nonNumbers);

var inputWords = [];
var separ = [',', ';'];
inputWords = readline().split(new RegExp(separ.join('|'), 'g'));

var numbers = "";
var nonNumbers = "";

for (i = 0; i < inputWords.length; i++)
{
    var reg = new RegExp('^[0-9]+$');
    if (reg.test(inputWords[i]))
    {
        if (inputWords[i].length > 1 && inputWords[i].charAt(0) == '0')
        {
            nonNumbers += inputWords[i] + ",";
        }
        else
        {
            numbers += inputWords[i] + ",";
        }
    }
    else
    {
        nonNumbers += inputWords[i] + ",";
    }
}

print (numbers + "\n");
print (nonNumbers);

readline().split(/,|;/).reduce((ab, word) => {
    if (!word || word.match(/[0]+[0-9]+/) || !word.match(/^\d+$/)) {
        ab[1].push(word);
    } else {
        ab[0].push(word);
    }
    return ab;
}, [[],[]])
.map(result => result.length > 0 ? "\"" + result.join(',') + "\"" : "-")
.forEach(result => print(result));

var inp = readline().split(/[,;]/g), n = inp.length;

var a = "", b = "";

for(var i = 0; i < n; i++){
    var str = inp[i];

    if(str === "" || isNaN(+str)) {b += str + ",";continue;}
    if(/^0+/.test(str) && str != "0") {b += str + ",";continue;}
    if(!/^\d+$/.test(str)) { b += str + ","; continue; }
    str = +str;
    a += str + ",";
}

if(a.length === 0)
    print("\"" + a.substring(0, a.length - 1) + "\"");
else print("-");
if(b.length === 0)
    print("\"" + b.substring(0, b.length - 1) + "\"");
else print("-");

var inp = readline().split(/[,;]/g), n = inp.length;

var a = "", b = "";

for(var i = 0; i < n; i++){
    var str = inp[i];

    if(str.length == "" || isNaN(+str)) {b += str + ",";continue;}
    if(/^0+/.test(str) && str != "0") {b += str + ",";continue;}
    if(!/^\d+$/.test(str)) { b += str + ","; continue; }
    str = +str;
    a += str + ",";
}

print("\"" + a.substring(0, a.length - 1) + "\"");
print("\"" + b.substring(0, b.length - 1) + "\"");

var inp = readline().split(/[,;]/g), n = inp.length;

var a = "", b = "";

for(var i = 0; i < n; i++){
    var str = inp[i];

    if(str === "" || isNaN(+str)) {b += str + ",";continue;}
    if(/^0+/.test(str) && str != "0") {b += str + ",";continue;}
    if(!/^\d+$/.test(str)) { b += str + ","; continue; }
    str = +str;
    a += str + ",";
}

if(a.length !== 0)
    print("\"" + a.substring(0, a.length - 1) + "\"");
else print("-");
if(b.length !== 0)
    print("\"" + b.substring(0, b.length - 1) + "\"");
else print("-");

var inp = readline().split(/,;/g), n = inp.length;

var a = "", b = "";

for(var i = 0; i < n; i++){
    var str = inp[i];

    if(str.length == "" || isNaN(+str)) {b += str + ",";continue;}
    if(/^0+/.test(str) && str != "0") {b += str + ",";continue;}
    if(!/^\d+$/.test(str)) { b += str + ","; continue; }
    str = +str;
    a += str + ",";
}

print("\"" + a.substring(0, a.length - 1) + "\"");
print("\"" + b.substring(0, b.length - 1) + "\"");

const isNumber = (val) => {
  const num = parseInt(val);
  return `${num}` === val;
};

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );
  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumber(word)) {
      a.push(word);
      return;
    }

    b.push(word);
    if (word.length < 1) {
      emptyCount++;
    }
  });

  process.stdout.write(`"${a.length < 1 ? '-' : a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(`"${b.length < 1 || b.length === emptyCount ? '-' : b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join(''));
    process.exit(0);
  });
})();

const isNumber = (val) => {
  const num = parseInt(val, 10);
  return `${num}` === val;
};

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );
  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumber(word)) {
      a.push(word);
      return;
    }

    b.push(word);
    if (word.length < 1) {
      emptyCount++;
    }
  });

  process.stdout.write(`"${a.length < 1 ? '-' : a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(`"${b.length < 1 || b.length === emptyCount ? '-' : b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join(''));
    process.exit(0);
  });
})();

const isNumber = str => /^[1-9][0-9]+$/.test(str);

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );

  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumber(word)) {
      a.push(word);
      return;
    }

    b.push(word);
  });

  process.stdout.write(a.length < 1 ?  '-' : `"${a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(b.length < 1 ?  '-' : `"${b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join('').trim());
    process.exit(0);
  });
})();

const isNumber = str => /^[0-9]+$/.test(str);

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );

  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumber(word)) {
      a.push(word);
      return;
    }

    b.push(word);
  });

  process.stdout.write(a.length < 1 ?  '-' : `"${a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(b.length < 1 ?  '-' : `"${b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join('').trim());
    process.exit(0);
  });
})();

const isNumber = (val) => {
  const num = parseInt(val, 10);
  return `${num}` === val;
};

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );

  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumber(word)) {
      a.push(word);
      return;
    }

    b.push(word);
  });

  process.stdout.write(a.length < 1 ?  '-' : `"${a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(b.length < 1 ?  '-' : `"${b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join('').trim());
    process.exit(0);
  });
})();

const isNumber = (val) => {
  const num = parseInt(val);
  return `${num}` === val;
};

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );
  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumber(word)) {
      a.push(word);
      return;
    }

    b.push(word);
    if (word.length < 1) {
      emptyCount++;
    }
  });

  process.stdout.write(a.length < 1 ? '-' : a.join(','));
  process.stdout.write('\n');
  process.stdout.write(b.length < 1 || b.length === emptyCount ? '-' : b.join(','));
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join(''));
    process.exit(0);
  });
})();

const zeroCharCode = '0'.charCodeAt(0);
const numberMap = new Map([
  [ zeroCharCode, 0 ],
  [ '1'.charCodeAt(0), 1 ],
  [ '2'.charCodeAt(0), 2 ],
  [ '3'.charCodeAt(0), 3 ],
  [ '4'.charCodeAt(0), 4 ],
  [ '5'.charCodeAt(0), 5 ],
  [ '6'.charCodeAt(0), 6 ],
  [ '7'.charCodeAt(0), 7 ],
  [ '8'.charCodeAt(0), 8 ],
  [ '9'.charCodeAt(0), 9 ]
]);
const isNumber = (str, at) => numberMap.has(str.charCodeAt(at));
const isNumeric = (str) => {
  if(str.length < 1) {
    return false;
  }

  if(str.length === 1) {
    return isNumber(str, 0);
  }

  if (str.charCodeAt(0) !== zeroCharCode) {
    return false;
  }

  for (const i = str.length - 1; i >= 0; i--) {
    if(!isNumber(str, i)) {
      return false;
    }
  }
  return true;
}

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );

  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumeric(word)) {
      a.push(word);
      return;
    }

    b.push(word);
  });

  process.stdout.write(a.length < 1 ?  '-' : `"${a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(b.length < 1 ?  '-' : `"${b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join('').trim());
    process.exit(0);
  });
})();

const isNumber = (val) => {
  const num = parseInt(val, 10);
  return `${num}` === val;
};

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );

  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumber(word)) {
      a.push(word);
      return;
    }

    b.push(word);
    if (word.length < 1) {
      emptyCount++;
    }
  });

  process.stdout.write(`"${a.length < 1 ? '-' : a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(`"${b.length < 1 || b.length === emptyCount ? '-' : b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join('').trim());
    process.exit(0);
  });
})();

const isNumber = (val) => {
  const num = parseInt(val, 10);
  return `${num}` === val;
};

const processInput = input => {
  const wordList = input
    .split(',')
    .reduce(
      (list, item) => [...list, ...item.split(';')],
      []
    );

  let a = [];
  let b = [];
  let emptyCount = 0;
  wordList.forEach(word => {
    if(isNumber(word)) {
      a.push(word);
      return;
    }

    b.push(word);
    if (word.length < 1) {
      emptyCount++;
    }
  });

  process.stdout.write(a.length < 1 ?  '-' : `"${a.join(',')}"`);
  process.stdout.write('\n');
  process.stdout.write(b.length < 1 || b.length === emptyCount ?  '-' : `"${b.join(',')}"`);
};

(() => {
  process.stdin.setEncoding('utf8');
  const chunkList = [];
  process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
      chunkList.push(chunk);
    }
  });
  process.stdin.on('end', () => {
    processInput(chunkList.join('').trim());
    process.exit(0);
  });
})();

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

function findWord(word){
    let sum = 0;
    for (let i = 0; i <= Math.floor(word.length / 2); i++){
        if (word[i] >= '0' && word[i] <= '9' || word[word.length - i - 1] >= '0' && word[word.length - i - 1] <= '9'){
            sum = sum + 1;
        }
    }
    if (sum === Math.floor(word.length / 2)){
        return false;
    } else {
        return true;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    rl.close();
})

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

function findWord(word){
    let ch = 0, digit = 0;
    if (word.length === 0){
        return true;
    }
    for (let i = 0; i < Math.ceil(word.length / 2); i++){
        if (word[i] >= '0' && word[i] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
        if (word[word.length - i - 1] >= '0' && word[word.length - i - 1] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
    }
    if (ch === 0){
        return false;
    } else {
        return true;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    rl.close();
})

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

function findWord(word){
    for (let i = 0; i <= Math.floor(word.length / 2); i++){
        if (word[i] >= '0' && word[i] <= '9' || word[word.length - i - 1] >= '0' && word[word.length - i - 1] <= '9'){
            return false;
        }
        return true;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    rl.close();
})

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

function findWord(word){
    let ch = 0, digit = 0;
    if (word.length === 0){
        return true;
    }
    for (let i = 0; i < Math.ceil(word.length / 2); i++){
        if (word[i] >= '0' && word[i] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
        if (word[word.length - i - 1] >= '0' && word[word.length - i - 1] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
    }
    if (ch === 0){
        return false;
    } else {
        return true;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false, ck = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if (x.length === 0)ck = true;
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0 && ck === false){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    console.log(res);
    rl.close();
})

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

function findWord(word){
    let ch = 0, digit = 0;
    if (word.length === 0){
        return true;
    }
    for (let i = 0; i < Math.ceil(word.length / 2); i++){
        if (word[i] >= '0' && word[i] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
        if (word[word.length - i - 1] >= '0' && word[word.length - i - 1] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
    }
    if (ch === 0){
        return false;
    } else {
        return true;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    console.log(res);
    rl.close();
})

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

function findWord(word){
    for (let i = 0; i < Math.floor(word.length / 2); i++){
        if (word[i] >= 'a' && word[i] <= 'z' || word[word.length - i - 1] >= 'a' && word[word.length - i - 1] <= 'z'){
            return true;
        }
        return false;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    rl.close();
})

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

function findWord(word){
    let ch = 0, digit = 0;
    for (let i = 0; i < Math.ceil(word.length / 2); i++){
        if (word[i] >= '0' && word[i] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
        if (word[word.length - i - 1] >= '0' && word[word.length - i - 1] <= '9'){
            digit = digit + 1;
        } else {
            ch = ch + 1;
        }
    }
    if (ch === 0){
        return false;
    } else {
        return true;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    rl.close();
})

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

function findWord(word){
    for (let i = 0; i <= Math.floor(word.length / 2); i++){
        if (word[i] >= 'a' && word[i] <= 'z' || word[word.length - i - 1] >= 'a' && word[word.length - i - 1] <= 'z'){
            return true;
        }
        return false;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    rl.close();
})

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

function findWord(word){
    for (let i = 0; i < Math.floor(word.length / 2); i++){
        if (word[i] >= 'a' && word[i] <= 'z' || word[word.length - i - 1] >= 'a' && word[word.length - i - 1] <= 'z'){
            return true;
        }
        return false;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log(a);
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log(b);
    }
    rl.close();
})

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

function findWord(word){
    let sum = 0;
    for (let i = 0; i <= Math.floor(word.length / 2); i++){
        if (word[i] >= '0' && word[i] <= '9' || word[word.length - i - 1] >= '0' && word[word.length - i - 1] <= '9'){
            sum++;
        }
    }
    if (sum === Math.floor(word.length / 2)){
        return false;
    } else {
        return true;
    }
}

rl.on('line', (input) => {
    s = "", a = "", b = "", flag1 = false, flag2 = false;
    res = input.split(/[,;]/);
    res.map(x => {
        if ((x.charAt(0) === '0' && x.length > 1) || findWord(x) || x.length === 0){
            if (flag1 === false)b += x;
            else b += "," + x;
            flag1 = true;
        }
        else {
            if (flag2 === false)a += x;
            else a += "," + x;
            flag2 = true;
        }
    });
    if (a.length === 0){
        console.log("-");
    } else {
        console.log("\"" + a + "\"");
    }
    if (b.length === 0){
        console.log("-");
    } else {
        console.log("\"" + b + "\"");
    }
    rl.close();
})


You are given a integer $$$n$$$ ($$$n > 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$:   $$$s > 0$$$,  $$$s$$$ consists of $$$n$$$ digits,  no digit in $$$s$$$ equals $$$0$$$,  $$$s$$$ is not divisible by any of it's digits.

The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum of $$$n$$$ for all test cases does not exceed $$$10^5$$$.

For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.

//var input = readline();
var T = parseInt(readline());

for (var i = 0; i < T; i++) {
    var n = parseInt(readline());
    if (n == 1) print(-1);
    else {
        write(2);
        n--;
        while (n-- > 0) {
            write(3);
        }   print('\n');
    }
}

var t = readline().split('\n');

for(var i = 1; i <= t ; ++i){
    var n = readline().split('\n');
    if(n == 1){
        print("-1");
    }
    else{
        var string = [];
        for(var j = 1; j <= n - 2 ; ++j)
            string += '9';

        string += '29';
        print(string);
    }
}

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()
    if(n === 1) wr(-1)
    else {
      let a = new Array(n).fill(9)
      a[n-1] = 8
      wr(a.join(''))
    }
  }
}

const mainFunction = (lines) => {
    let n = +lines[0];
    for(let i = 1; i < n + 1; i++) {
        let qwe = +lines[i];
        if(qwe != 1){ qwe--;
            let ans = "2";
            while(qwe--) ans += '3';
            console.log(ans);
        }
        else console.log(-1);
    }
}

const {EOL} = require('os')
const fs = require("fs");
if(__filename.substr(9,4) != "azer"){
    let yourInput = ''
    process.stdin.on('data', i => yourInput += i)
    process.stdin.on('end', () => mainFunction(yourInput.split(EOL)))
} else {
    mainFunction(fs.readFileSync('input.txt', 'utf8').split(EOL))
}

let yourInputData = ''
process.stdin.on('data', i => yourInputData += i)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = yourInputData.split(EOL)
    mainFunction(lines)
})

const mainFunction = (lines) => {
    let n = +lines[0];
    for(let i = 1; i < n + 1; i++) {
        let qwe = +lines[i];
        if(qwe != 1){ qwe--;
            let ans = "2";
            while(qwe--) ans += '3';
            console.log(ans);
        }
        else console.log(-1);
    }
}

const mainFunction = (lines) => {
    let n = +lines[0];
    for(let i = 1; i < n + 1; i++) {
        let qwe = +lines[i];
        if(qwe != 1){ qwe--;
            let ans = "2";
            while(qwe--) ans += '3';
            console.log(ans);
        }
        else console.log(-1);
    }
}

const {EOL} = require('os')
const fs = require("fs");
if(__filename.substr(9,4) != "azer"){
    let yourInputData = ''
    process.stdin.on('data', i => yourInputData += i)
    process.stdin.on('end', () => {
        const lines = yourInputData.split(EOL)
        mainFunction(lines)
    })
} else {
    mainFunction(fs.readFileSync('input.txt', 'utf8').split(EOL))
}

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

function main() {
    let tests = parseInt(readline());
    while(tests--){
        let num = parseInt(readline());
        if(num == 1) console.log("-1");
        else{
            let ans = "3".repeat(num - 1);
            console.log("2"+ans);
        }
    }
}

const processData = (lines) => {
  const num = +lines[0]
  for (let j =0; j<num; j++) {
    const n = +lines[j+1]
    if (n<=1) {
      console.log(-1)
    } else {
      console.log((new Array(n -1).fill('5')).concat([8]).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)
})

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

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

const store = {};

function main() {
	let t = readLine() >> 0;

	while (t--) {
		let n = readLine() >> 0;

		if (n <= 1) {
			console.log(-1);
			continue;
		}

		console.log(`2${'3'.repeat(n - 1)}`);
	}
}

//var input = readline();
var T = parseInt(readline());

for (var i = 0; i < T; i++) {
    var n = parseInt(readline());
    if (n == 1) print(-1);
    else {
        write(3);
        n--;
        while (n-- > 0) {
            write(1);
        }
    }
}

var t = readline().split('\n');

for(var i = 1; i <= t ; ++i){
    var n = readline().split('\n');
    if(n == 1){
        print("-1");
    }
    var string = [];
    for(var j = 1; j <= n - 2 ; ++j)
        string += '9';

    string += '29';
    print(string);
}

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

for(var i = 1; i <= t ; ++i){
    var n = readline().split(' ');
    print(n);
}

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

for(var i = 1; i <= t ; ++i){
    var n = readline().split(' ');
    if(n == 1){
        print("-1");
    }
    var string = "";
    for(var j = 1; j <= n - 2 ; ++j)
        string += "9";

    string = string + "2" + "9";
    print(string);
}

var t = readline().split('\n');

for(var i = 1; i <= t ; ++i){
    var n = readline().split('\n');
    if(n == 1){
        print("-1");
    }
    var string = "";
    for(var j = 1; j <= n - 2 ; ++j)
        string += '9';

    string += '29';
    print(string);
}

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

for(var i = 1; i <= t ; ++i){
    var n = readline().split(' ');
    if(n == 1){
        print("-1\n");
    }
    for(var j = 1; j <= n - 2 ; ++j){
        print("9");
    }
    print("29\n");
}

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

for(var i = 1; i <= t ; ++i){
    var n = readline().split(' ');
    if(n == 1){
        print("-1");
    }
    var string = [];
    for(var j = 1; j <= n - 2 ; ++j)
        string += '9';

    string += '29';
    print(string);
}


There is a field divided into $$$n$$$ rows and $$$m$$$ columns. Some cells are empty (denoted as E), other cells contain robots (denoted as R).You can send a command to all robots at the same time. The command can be of one of the four types:  move up;  move right;  move down;  move left. When you send a command, all robots at the same time attempt to take one step in the direction you picked. If a robot tries to move outside the field, it explodes; otherwise, every robot moves to an adjacent cell in the chosen direction.You can send as many commands as you want (possibly, zero), in any order. Your goal is to make at least one robot reach the upper left corner of the field. Can you do this without forcing any of the robots to explode?

The first line contains one integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of test cases. Each test case starts with a line containing two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5$$$) — the number of rows and the number of columns, respectively. Then $$$n$$$ lines follow; each of them contains a string of $$$m$$$ characters. Each character is either E (empty cell} or R (robot). Additional constraint on the input: in each test case, there is at least one robot on the field.

If it is possible to make at least one robot reach the upper left corner of the field so that no robot explodes, print YES. Otherwise, print NO.

6

1 3

ERR

2 2

ER

RE

2 2

ER

ER

1 1

R

4 3

EEE

EEE

ERR

EER

3 3

EEE

EER

REE

NoteExplanations for test cases of the example:  in the first test case, it is enough to send a command to move left.  in the second test case, if you try to send any command, at least one robot explodes.  in the third test case, it is enough to send a command to move left.  in the fourth test case, there is already a robot in the upper left corner.  in the fifth test case, the sequence "move up, move left, move up" leads one robot to the upper left corner;  in the sixth test case, if you try to move any robot to the upper left corner, at least one other robot explodes.

process.stdin.resume();
process.stdin.setEncoding("ascii");

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

process.stdin.on("data", function (data) {
  input_stdin += data;
});

process.stdin.on("end", function () {
  input_stdin_array = input_stdin.split("\n");
  // console.log(input_stdin_array);
  main();
});

function readLine() {
  return input_stdin_array[input_currentline++];
}

function main() {
  var a = readLine();
  while (a--) {
    var b = readLine();
    b = b.split(" ");
    let n = parseInt(b[0]);
    let arr = [];
    while (n--) {
      var c = readLine();
      arr.push(c.replace("\r", ""));
    }
    var res = solveMeFirst(arr);
    // let out = "";
    // if (res) {
    //   for (let i = 0; i < res.length; i++) {
    //     out += res[i] + " ";
    //   }
    console.log(res);
    // }
  }
}
function solveMeFirst(arr) {
  // console.log(arr);
  let col = false;
  for (let i = 0; i < arr.length; i++) {
    for (let j = 0; j < arr[i].length; j++) {
      if (arr[i][j] === "R" && col === false) {
        col = j;
      } else if (arr[i][j] === "R" && col !== false) {
        if (col > j) return "NO";
      }
    }
  }
  return "YES";
}

// console.log(solveMeFirst(2, [2, 3, 2, 4, 1, 3, 4, 1]));
// console.log(timeConversion([100, 90, 90, 80], [70, 80, 105]));

'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)
}

class Robot {
    constructor(row, col) {
        this.row = row;
        this.col = col;
    }

    willExplode(first) {
        return this.row < first.row || this.col < first.col;
    }
}

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

    for (let test = 0; test < N; test++) {
        let n = parseInt(readline(), 10);

        let first;
        let willExplode = false;

        for (let i = 0; i < n; i++) {
            let row = readline().split('');

            for (let j = 0; j < row.length; j++) {
                if (row[j] === 'R') {
                    if (!first) {
                        first = new Robot(i, j);
                    } else {
                        let curr = new Robot(i, j);
                        if (curr.willExplode(first)) {
                            willExplode = true;
                        }
                    }
                }
            }
        }

        output(willExplode ? 'NO' : 'YES');
    }
}

const readline = require('readline')

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

function solve(n, m, grid) {
    let r = n
    let c = m
    for (let i = 0; i < n; i++) {
        for (let j = 0; j < m; j++) {
            if (grid[i][j] === 'R') {
                r = Math.min(r, i)
                c = Math.min(c, j)
            }
        }
    }
    return r < n && c < m && grid[r][c] === 'R'
}

'use strict';
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();
});
const input = () => inputString[currentLine++];

const main = () => {
  let tc = parseInt(input());
  while(tc--){
    const [n, m] = input().split(' ').map(Number);
    const f = [];
    for(let i = 0; i < n; i++){
      const s = input().split('');
      f.push(s);
    }
    let my = n-1;
    let mx = m-1;
    for(let y = 0; y < n; y++){
      for(let x = 0; x < m; x++){
        if(f[y][x] === 'R'){
          my = Math.min(my, y);
          mx = Math.min(mx, x);
        }
      }
    }
    if(f[my][mx] === 'R') console.log("YES");
    else console.log("NO");
  }
}

'use strict';

var readline = require('readline');

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

var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);

function solve(n, m, s) {
  let robot = null;
  for (let i = 0; i < n; i++) {
    for (let j = 0; j < m; j++) {
      if (s[i][j] === 'R') {
        if (!robot) {
          robot = [i, j];
        } else {
          if (i < robot[0] || j < robot[1]) {
            return 'NO';
          }
        }
      }
    }
  }
  return 'YES';
}

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

const rl = readline__default["default"].createInterface({
  input: process.stdin,
  output: process.stdout
});
void async function () {
  const inputs = [];
  let i = 0;
  for await (const line of rl) {
    inputs.push(line.trim());
  }
  function read() {
    return inputs[i++];
  }
  await main(read);
}();

const lines = [];
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
rl.on('line', line => lines.push(line));
rl.on('close', main);
let rli = 0;
function readline() {
    return lines[rli++];
}

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

/*---------------------------------------------------*/

const calc = ()=>{
    /* read */
    let [n, m] = ra();
    let grid = [];
    for (let i = 0; i < n; i++) {
        grid.push(readline().split(''));
    }
    // console.log('DEBUG grid', grid);

    let x, y;
    for (let i = 0; i < n; i++) {
        if (x !== undefined) break;
        for (let j = 0; j < m; j++) {
            if (grid[i][j] === 'R') {
                x = i;
                y = j;
                break;
            }
        }
    }
    // console.log('DEBUG x', x);
    // console.log('DEBUG y', y);

    for (let i = x; i < n; i++) {
        for (let j = 0; j < y; j++) {
            if (grid[i][j] === 'R') {
                return 'NO';
            }
        }
    }

    return 'YES';
};

function main() {
    let T = +readline();
    let out = [];
    for (let t = 1; t <= T; t++){
        out.push(calc());
        // process.stdout.write(`${calc(n, a)}\n`);
    }
    process.stdout.write(out.join('\n')+'\n');
}

'use strict';
// HEADER:
const print = console.log;
let IS_MULTITEST, testN;
const pcalc = testN=>{
  let res = calc(testN);
  if (Array.isArray(res)){
    pa(res);
  } else if (Number.isFinite(res) || typeof res=='string'){
    print(res);
  }
};

const main = ()=>{
  if (IS_MULTITEST){
    let T = +readline()
    for (testN=1; testN<=T; testN++)
      pcalc(T);
  } else
   pcalc();
};

const lines = [];
const rl = require('readline').createInterface({
   input: process.stdin, output: process.stdout});
rl.on('line', line=>{
  lines.push(line);
});
rl.on('close', main);
let rli = 0;
const readline = ()=>lines[rli++];
const L = process.env.DEBUG ? console.log : ()=>{};
const LT = obj=>L(`Test #${testN}`, obj);

const ra = ()=>readline().split(' ').map(a=>+a)
const pa = arr=>print(arr.join(' '));

// SOLUTION:
IS_MULTITEST = 1;

const calc = ()=>{
  // READING:
  let [n, m] = ra();
  let A = [];
  for (let i=0; i<n; i++)
    A.push(readline());
  LT({n, m, A});
  // PROCESSING:
  let mini = Infinity;
  let minj = Infinity;
  for (let i=0; i<n; i++){
    for (let j=0; j<m; j++){
      if (A[i][j]=='R'){
        mini = Math.min(mini, i)
        minj = Math.min(minj, j)
      }
    }
  }
  L({mini, minj})
  if (mini==Infinity)
    return 'NO'
  return A[mini][minj]=='R' ? 'YES' : 'NO'
};

var t = +readline();

for(var i = 0; i< t; i ++) {
    var ab = readline();
    var a = +ab[0];
    var b = ab[1];
    var list = [];
    for(var j = 0; j<a;j++){
          var test = readline();
          list.push(test);
    }
    print(Task1(list));

}

function Task1(grid){

   var find = null;
  var check = null;
  for(var i = 0; i<grid.length; i++){

    for(var j = 0; j<grid[0].length; j++){
      if (grid[i][j] === 'R'){
        if (find === null){
          find = j;
          check = j;
        }else {
          check = Math.min(check,j);
        }
      }

    }
  }
  if (check < find) return 'NO';
  else return 'YES';

}

//import { readline, print } from '@ip-algorithmics/codeforces-io';
var t = +readline();
while (t--) {
    var _a = readline().split(' ').map(function (v) { return +v; }), n = _a[0], m = _a[1];
    var first = -1;
    var min = 10000;
    var firstX = 0, minY = 0;
    var a = Array(n);
    for (var i = 0; i < n; i++) {
        a[i] = readline();
        var index = a[i].indexOf('R');
        if (first === -1 && index !== -1) {
            first = i;
            firstX = index;
        }
        if (index !== -1 && index < min) {
            min = index;
            minY = i;
        }
    }
    print(firstX === min && minY === first ? 'YES' : 'NO');
}

process.stdin.resume();
process.stdin.setEncoding("ascii");

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

process.stdin.on("data", function (data) {
  input_stdin += data;
});

process.stdin.on("end", function () {
  input_stdin_array = input_stdin.split("\n");
  // console.log(input_stdin_array);
  main();
});

function readLine() {
  return input_stdin_array[input_currentline++];
}

function main() {
  var a = readLine();
  while (a--) {
    var b = readLine();
    b = b.split(" ");
    let n = parseInt(b[0]);
    let arr = [];
    while (n--) {
      var c = readLine();
      arr.push(c.replace("\r", ""));
    }
    var res = solveMeFirst(arr);
    // let out = "";
    // if (res) {
    //   for (let i = 0; i < res.length; i++) {
    //     out += res[i] + " ";
    //   }
    console.log(res);
    // }
  }
}
function solveMeFirst(arr) {
  // console.log(arr);
  let col = false;
  for (let i = 0; i < arr.length; i++) {
    for (let j = 0; j < arr[i].length; j++) {
      if (arr[i][j] === "R" && !col) {
        col = j;
      } else if (arr[i][j] === "R" && col) {
        if (col > j) return "NO";
      }
    }
  }
  return "YES";
}

// console.log(solveMeFirst(2, [2, 3, 2, 4, 1, 3, 4, 1]));
// console.log(timeConversion([100, 90, 90, 80], [70, 80, 105]));


You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is the operation of assignment (i.e. you choose $$$i$$$ and $$$j$$$ and replace $$$a_i$$$ with $$$a_j$$$).Your task is to say if it is possible to obtain an array with an odd (not divisible by $$$2$$$) sum of elements.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2000$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2000$$$ ($$$\sum n \le 2000$$$).

For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise.

function runProgram(input){
    input= input.split("\n");
    var t = Number(input[0]);
    for(var i=0;i<t;i++){

        var n = Number(input[2*i+1]);
        var arr = input[2*i+2].split(" ");
        var sum = 0;
        for(var k = 0;k<n;k++){
            sum = sum + Number(arr[k]);
        }
        if(sum%2==0){
            cnt=0
            for(var x=0;x<n;x++){
                if(Number(arr[x])%2==1){
                    cnt=cnt+1;
                }
            }
            if(cnt==n && n%2==0){
                console.log("NO");
            }
            else if(cnt==0){
                console.log("NO")
            }
            else{
                console.log("YES")
            }
        }
        else{
            console.log("YES")
        }
    }
}
process.stdin.resume();
process.stdin.setEncoding("ascii");
let read = "";
process.stdin.on("data", function (input) {
    read += input;
});
process.stdin.on("end", function () {
    read = read.replace(/\n$/,"")
    runProgram(read);
});

process.on("SIGINT", function () {
    read = read.replace(/\n$/,"")
    runProgram(read);
    process.exit(0);
});

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()
    let sum = a.reduce((a, b) => a + b, 0)
    if(sum % 2 === 1) {
      wr('YES')
    }
    else {
      let e = false
      let o = false
      a.forEach(el => {
        if(el % 2 === 0) e = true
        else o = true
      })
      if(!o || !e) {
        wr('NO')
      }
      else wr('YES')
    }
  }
}

function main() {
    n = readInt()
    li = readInts()
    odd = li.filter(x => x%2!=0).length
    even = li.filter(x => x%2==0).length
    //print(n, li)
    if ((n%2==1 || even>0) && odd>0){
        print("YES")
    } else {
        print("NO")
    }
}

const TESTCASES = true
/* NodeJS Footer by @satyamcse and @shivam1420*/
var readline = require('readline');
process.stdin.setEncoding('utf-8');
var rl = readline.createInterface({input: process.stdin, output: process.stdout});
var inp = "";
rl.on('line' , v => inp += v+"\n");
rl.on('close', () => {
    inp = inp.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
    if (TESTCASES){
        const cnt = readInt()
        for (let i = 0; i<cnt; i++){
            main()
        }
    } else {main()}
});
function sort(a, inc = true) {
    if(inc) a.sort((a, b) => a - b)
    else a.sort((a, b) => b - a)
}
var ptr = 0
function print(...x) {console.log(...x)}
function readInt() {return +inp[ptr++]}
function readLine() {return inp[ptr++]}
function readInts() {return inp[ptr++].split(' ').map(a => +a)}

//DISABLE THIS LINE END ENABLE NEXT
//const rl =  require('readline').createInterface({input: require('fs').createReadStream('input.txt')});
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
const print = console.log
const write = (...args) => {
    process.stdout.write(args.join(' ') );
}
const lines = []
rl.on('line', line => {
    lines.push(line);
});
rl.on('close', main)

let rli = 0;
function readline() {
    return lines[rli++];
}

function main() {
    //var y = +readline() + 1;
    var y = +readline()
    while(y > 0) {
		var z = readline();
		var arr = readline();
		var a = arr.split(' ');
		var a_even = (a.length % 2 === 0)?1:0;
		var odd = 0;
		var even = 0;
		var res = 'NO';
		for(var i = 0 ; i < a.length; i++) {
			if (odd === 1 && a_even == 0) {
				res = 'YES';
				break;
			}
			if (odd == 1 && even == 1) {
				res = 'YES';
				break;
			}
			if (a[i] % 2 == 0) {
				even = 1;
			} else {
				odd = 1;
			}
		}
		if (odd === 1 && a_even == 0) {
			res = 'YES';
		}
		if (odd == 1 && even == 1) {
			res = 'YES';
		}
		write(res +'\n');
		//write("\n");
		y--;
    }
    //const check = (x) => (x + '').length === new Set(x + '').size
	//while (!check(y)) y++
    //write(y);
}

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

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

  if (c % 2 !== 0) {
    c++;
    return;
  }

  const arr = d.split(' ').map(Number);
  let ans = 'NO';
  let sum = 0;

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

    for (let j = 0; j < arr.length; j++) {
      if ((arr[i] + arr[j]) % 2 !== 0) {
        ans = 'YES';
        break;
      }
    }
  }

  if (sum % 2 !== 0) {
    ans = 'YES';
  }

  console.log(ans);

  c++;
});

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

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

  if (c % 2 !== 0) {
    c++;
    return;
  }

  const arr = d.split(' ').map(Number);
  let sum = 0;

  let isOdd = false;
  let isEven = false;
  for (let i = 0; i < arr.length; i++) {
    sum += arr[i];

    if (arr[i] % 2 === 0) {
      isEven = true;
    }
    else {
      isOdd = true;
    }
  }

  if (sum % 2 !== 0 || (isEven && isOdd)) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }

  // let ans = 'NO';
  // let sum = 0;

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

  //   for (let j = 0; j < arr.length; j++) {
  //     if ((arr[i] + arr[j]) % 2 !== 0) {
  //       ans = 'YES';
  //       break;
  //     }
  //   }
  // }

  // if (sum % 2 !== 0) {
  //   ans = 'YES';
  // }

  // console.log(ans);

  c++;
});

const calc = (d, x) => Math.ceil( d / (x + 1) + x)

const processData = (lines) => {
  const num = +lines[0]

  for (let j=0; j<num; j++){
    const numsLine = lines[j*2+2].split(' ').map(x => x%2)
    let isEvenNum = false
    let isOddNum = false
    for (const n of numsLine) {
      if (n === 0) {
        isEvenNum = true
      }
      if (n === 1) {
        isOddNum = true
      }
    }
    if (isEvenNum && isOddNum){
      console.log('YES')
    } else {
      if (isOddNum && numsLine.reduce((r, x) => r + x, 0)%2 === 1){
        console.log('YES')
      } else {
        console.log('NO')
      }
    }
  }
}

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

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

const input = [];
readline.on('line', x => input.push(x));

readline.on('close', () => {
    const n = parseInt(input[0]);
    for (let i = 1; i <= n * 2; i += 2) {
        const len = parseInt(input[i]);
        let even = 0;
        let odd = 0;
        const arr = Array.from(input[i + 1].split(' '), x => {
            x = parseInt(x);
            if (x % 2 === 0) even++;
            else odd++;
            return x;
        });

        if (odd % 2 === 1) {
            console.log("YES");
        } else {
            if (odd + 1 > 1 && even - 1 >= 0) {
                console.log("YES");
            } else {
                console.log("NO");
            }
        }
    }
});

function processData(input) {
    //Enter your code here
    var data = input.split('\n')
    var tcs = Number(data[0])
    var line = 1
    for(var i = 0;i<tcs;i++){
        var len = Number(data[line])
        line++
        var arr = data[line].split(' ').map(a=>parseInt(a))
        line++
        var res = findOdd(len,arr)
        console.log(res)
    }
    function findOdd(len,arr){
        var sum = 0
        var countEven =0
        var countOdd =0
        for(var i = 0;i<len;i++){
            sum += arr[i]
        }
        if(sum%2==1){
              return "YES"
        }
        else{
           for(var i =0;i<len;i++){
               if(arr[i]%2==0){
                   countEven++
               }
               else{
                   countOdd++
               }
           }
            if(countEven>=1 && countOdd>=1){
                return "YES"
            }
            else{
                return "NO"
            }

        }
    }
}

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

process.stdin.on("end", function () {
   processData(_input);
});

'use strict'

let t = parseInt(readline())
while (t --> 0) {
  const n = parseInt(readline())
  const arr = readline().split(' ').map(num => parseInt(num))
  let odd = 0
  for (let i in arr) {
      if(arr[i] % 2) odd++
  }

  if ((odd % 2) || ((n - odd) > 0 && odd)) print('YES')
  else print('NO')
}

'use strict'

const problem = (n, a) => {
    const x = a[0];
    for (let i = 1; i < a.length; i++) if (a[i] !== x) return 'YES';
    if (x === 0 || a.length % 2 === 0) return 'NO';
    return 'YES'
}
let t = +readline();
while(t--) print(problem(+readline(), readline().split(' ').map(i => +i%2)))

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
//[no]param
//不明値:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
function myconv(i,no){switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").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;}}
function Main() {
    var t = myconv(next(),1);
    var output = new Array(t);
    for(var i = 0; i < t; i++){
        var N = myconv(next(),1);
        var list = myconv(next(),4);
            var odd = 0;
            var even = 0;
            for(var j = 0; j < N; j++){
                if(list[j] % 2 == 0){
                    even++;
                }else{
                    odd++;
                }
            }
            if(odd % 2 == 1 || (odd != 0 && odd % 2 == 0 && even >= 1)){
                output[i] = "YES";
            }else{
                output[i] = "NO";
            }
    }
    myout(myconv(output,9));
}

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

function main() {
  var testCasesNum = readNum();
  for (var i = 0; i < testCasesNum; i++) {
    var len = readNum();
    var arr = readNumArray();
    var isEvenLen = len % 2 === 0;
    var checked = checkArr(arr);

    if (isEvenLen) {
      if (checked.hasEven && checked.hasOdd) {
        print("YES");
      } else {
        print("NO");
      }
    } else {
      if (checked.hasOdd) {
        print("YES");
      } else {
        print("NO");
      }
    }
  }

}

const checkArr = arr => {
  var hasOdd = false;
  var hasEven = false;
  for (var i = 0; i < arr.length; i++) {
    if (arr[i] % 2 === 0) {
      hasEven = true;
    } else {
      hasOdd = true;
    }
    if (hasEven && hasOdd) {
      break;
    }
  }
  return {
    hasEven,
    hasOdd
  };
};
main();

function main() {
    var t = parseInt(readline());
    while(t-- > 0) {
        var n = parseInt(readline());
        var s = readline().split(" ");

        var sum = 0;
        var even = false; odd = false;
        for(var i = 0; i < n; i++) {
            sum += parseInt(s[i]);
            if (s[i] % 2 === 0) even = true;
            else odd = true;
        }

        if (sum % 2 === 1 || (even && odd))
            print("YES")
        else
            print("NO")
    }
}

main();

var amountOfSets = readline();
var results = [];
for (var i = 0; i<amountOfSets; i++) {
    var amountInSet = readline();
    var numbers = readline().split(' ');
    var evenNumber = false;
    var oddNumber = false;
    for (var j = 0; j<amountInSet; j++) {
        if (numbers[j]%2 === 0) {
            evenNumber = true;
        } else {
            oddNumber = true;
        }
        if (evenNumber && oddNumber) {
            results[i] = 'YES';
            break;
        }
    }
    if (!results[i]) {
        if (evenNumber) {
            results[i] = 'NO';
        } else if (amountInSet%2 === 0) {
            results[i] = 'NO';
        } else {
            results[i] = 'YES';
        }
    }
}

for (var t = 0; t<amountOfSets; t++) {
    print(results[t]);
}

//O(N)
//O(1)
function runProgram(input){
    input= input.split("\n");
    var t = Number(input[0]);
    for(var i=0;i<t;i++){

        var n = Number(input[2*i+1]);
        var arr = input[2*i+2].split(" ");
        var sum = 0;
        for(var k = 0;k<n;k++){
            sum = sum + Number(arr[k]);
        }
        if(sum%2==0){
            cnt=0
            for(var x=0;x<n;x++){
                if(Number(arr[x])%2==1){
                    cnt=cnt+1;
                }
            }
            if(cnt%2 == 0){
                console.log("NO");
            }
            else{
                console.log("YES")
            }

        }
        else{
            console.log("YES")
        }
    }
}
process.stdin.resume();
process.stdin.setEncoding("ascii");
let read = "";
process.stdin.on("data", function (input) {
    read += input;
});
process.stdin.on("end", function () {
    read = read.replace(/\n$/,"")
    runProgram(read);
});

process.on("SIGINT", function () {
    read = read.replace(/\n$/,"")
    runProgram(read);
    process.exit(0);
});

function runProgram(input){
    input= input.split("\n");
    var t = Number(input[0]);
    for(var i=0;i<t;i++){

        var n = Number(input[2*i+1]);
        var arr = input[2*i+2].split(" ");
        var sum = 0;
        for(var k = 0;k<n;k++){
            sum = sum + Number(arr[k]);
        }
        if(sum%2==0){
            cnt=0
            for(var i=0;i<n;i++){
                if(Number(arr[i])%2==1){
                    cnt=cnt+1;
                }
            }
            if(cnt%2 == 0){
                console.log("NO");
            }
            else{
                console.log("YES")
            }

        }
        else{
            console.log("YES")
        }
    }
}
process.stdin.resume();
process.stdin.setEncoding("ascii");
let read = "";
process.stdin.on("data", function (input) {
    read += input;
});
process.stdin.on("end", function () {
    read = read.replace(/\n$/,"")
    runProgram(read);
});

process.on("SIGINT", function () {
    read = read.replace(/\n$/,"")
    runProgram(read);
    process.exit(0);
});

function runProgram(input){
    input= input.split("\n");
    var t = Number(input[0]);
    for(var i=0;i<t;i++){

        var n = Number(input[2*i+1]);
        var arr = input[2*i+2].split(" ");
        var sum = 0;
        for(var k = 0;k<n;k++){
            sum = sum + Number(arr[k]);
        }
        if(sum%2==0){
            cnt=0
            for(var x=0;x<n;x++){
                if(Number(arr[x])%2==1){
                    cnt=cnt+1;
                }
            }
            if(cnt==n && n%2==1){
                console.log("NO");
            }
            else if(cnt==0){
                console.log("NO")
            }
            else{
                console.log("YES")
            }
        }
        else{
            console.log("YES")
        }
    }
}
process.stdin.resume();
process.stdin.setEncoding("ascii");
let read = "";
process.stdin.on("data", function (input) {
    read += input;
});
process.stdin.on("end", function () {
    read = read.replace(/\n$/,"")
    runProgram(read);
});

process.on("SIGINT", function () {
    read = read.replace(/\n$/,"")
    runProgram(read);
    process.exit(0);
});

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

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

  if (c % 2 !== 0) {
    c++;
    return;
  }

  const arr = d.split(' ').map(Number);
  const sum = arr.reduce((a, b) => a + b, 0);

  if (sum % 2 === 0) {
    console.log('NO');
  }
  else {
    console.log('YES');
  }

  c++;
});

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

});

function processData(input) {
    //Enter your code here
    var data = input.split('\n')
    var tcs = Number(data[0])
    var line =1
    for(let i = 0;i<tcs;i++){
        let len = Number(data[line])
        line++
        let arr = data[line].split(' ').map(a=>parseInt(a))
        line++
        let res = oddSum(len,arr)
        console.log(res)
    }
    function oddSum(len,arr){
        var count = 0
        for(let i = 0;i<len;i++){
            if(arr[i]%2 ==1){
                count++
            }
        }
        if(count % 2 ==1){
            return "YES"
        }
        else{
             return "NO"
        }
    }

}

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

process.stdin.on("end", function () {
   processData(_input);
});

'use strict'

let t = parseInt(readline())
while (t --> 0) {
  const n = parseInt(readline())
  let tot = 0
  const arr = readline().split(' ').map(item => tot += parseInt(item))
  print(tot % 2 == 0 ? 'NO' : 'YES')
}

'use strict'

let t = parseInt(readline())
while (t --> 0) {
  const n = parseInt(readline())
  const arr = readline().split(' ').map(item => parseInt(item))

  let tot = 0
  let odd = false
  for (let i in arr) {
    if (arr[i] % 2) odd = true
    tot += parseInt(arr[i])
  }

  print((tot % 2) || (odd &&  (n % 2)) ? 'YES' : 'NO')
}

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
//[no]param
//不明値:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
function myconv(i,no){switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").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;}}
function Main() {
    var t = myconv(next(),1);
    var output = new Array(t);
    for(var i = 0; i < t; i++){
        var N = myconv(next(),1);
        var list = myconv(next(),4);
        if(N == 1){
            if(list[0] % 2 == 0){
                output[i] = "NO";
            }else{
                output[i] = "YES";
            }
        }else{
            var odd = 0;
            var even = 0;
            for(var j = 0; j < N; j++){
                if(list[j] % 2 == 0){
                    even++;
                }else{
                    odd++;
                }
            }
            if(odd % 2 == 1 || (odd % 2 == 0 && even % 2 == 1)){
                output[i] = "YES";
            }else{
                output[i] = "NO";
            }
        }
    }
    myout(myconv(output,9));
}


You are given a binary matrix $$$A$$$ of size $$$n \times n$$$. Rows are numbered from top to bottom from $$$1$$$ to $$$n$$$, columns are numbered from left to right from $$$1$$$ to $$$n$$$. The element located at the intersection of row $$$i$$$ and column $$$j$$$ is called $$$A_{ij}$$$. Consider a set of $$$4$$$ operations:  Cyclically shift all rows up. The row with index $$$i$$$ will be written in place of the row $$$i-1$$$ ($$$2 \le i \le n$$$), the row with index $$$1$$$ will be written in place of the row $$$n$$$.  Cyclically shift all rows down. The row with index $$$i$$$ will be written in place of the row $$$i+1$$$ ($$$1 \le i \le n - 1$$$), the row with index $$$n$$$ will be written in place of the row $$$1$$$.  Cyclically shift all columns to the left. The column with index $$$j$$$ will be written in place of the column $$$j-1$$$ ($$$2 \le j \le n$$$), the column with index $$$1$$$ will be written in place of the column $$$n$$$.  Cyclically shift all columns to the right. The column with index $$$j$$$ will be written in place of the column $$$j+1$$$ ($$$1 \le j \le n - 1$$$), the column with index $$$n$$$ will be written in place of the column $$$1$$$.     The $$$3 \times 3$$$ matrix is shown on the left before the $$$3$$$-rd operation is applied to it, on the right — after. You can perform an arbitrary (possibly zero) number of operations on the matrix; the operations can be performed in any order.After that, you can perform an arbitrary (possibly zero) number of new xor-operations:  Select any element $$$A_{ij}$$$ and assign it with new value $$$A_{ij} \oplus 1$$$. In other words, the value of $$$(A_{ij} + 1) \bmod 2$$$ will have to be written into element $$$A_{ij}$$$. Each application of this xor-operation costs one burl. Note that the $$$4$$$ shift operations — are free. These $$$4$$$ operations can only be performed before xor-operations are performed.Output the minimum number of burles you would have to pay to make the $$$A$$$ matrix unitary. A unitary matrix is a matrix with ones on the main diagonal and the rest of its elements are zeros (that is, $$$A_{ij} = 1$$$ if $$$i = j$$$ and $$$A_{ij} = 0$$$ otherwise).

The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) —the number of test cases in the test. The descriptions of the test cases follow. Before each test case, an empty line is written in the input. The first line of each test case contains a single number $$$n$$$ ($$$1 \le n \le 2000$$$) This is followed by $$$n$$$ lines, each containing exactly $$$n$$$ characters and consisting only of zeros and ones. These lines describe the values in the elements of the matrix. It is guaranteed that the sum of $$$n^2$$$ values over all test cases does not exceed $$$4 \cdot 10^6$$$.

For each test case, output the minimum number of burles you would have to pay to make the $$$A$$$ matrix unitary. In other words, print the minimum number of xor-operations it will take after applying cyclic shifts to the matrix for the $$$A$$$ matrix to become unitary.

NoteIn the first test case, you can do the following: first, shift all the rows down cyclically, then the main diagonal of the matrix will contain only "1". Then it will be necessary to apply xor-operation to the only "1" that is not on the main diagonal.In the second test case, you can make a unitary matrix by applying the operation $$$2$$$ — cyclic shift of rows upward twice to the matrix.

var tests = parseInt(readline());
    for (var t=0; t < tests; t++) {
        readline();
        var n = parseInt(readline());
        var mat = [];
        for (var i = 0; i < n; i++) {
            var row = readline().split('').map(x=>parseInt(x));
            mat.push(row);
        }
        //console.log(mat);
        var maxD = [0, 0];
        for (var i = 0; i < n; i++) {
            var ones = 0;
            var col = i;
            for (var r = 0; r < n; r++) {
                ones += mat[r][col];
                col = ( col + 1 ) % n;
            }
            if (ones > maxD[1]) {
                maxD = [i, ones];
            }
            if (ones == n) {
                break;
            }
        }
        var burls = 0;
        for (var r = 0; r < n; r++) {
            var off = (r + maxD[0]) % n;
            for (var c = 0; c < n; c++) {
                if (off == c) {
                    burls+=mat[r][c]^1;
                } else {
                    burls+=mat[r][c];
                }
            }
        }
        print(burls);
    }

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

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

function main () {
	let T = rn();
	while (T--) {
		rl();
		const n = rn();
		const a = [];
		for (let i = 0; i < n; i++) {
			a[i] = rl().split('').map(x => Number(x));
		}

		let ones = 0;
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				ones += a[i][j] == 1;
			}
		}

		function getLen (ic, jc) {
			let len = 1, i, j;
			i = ic, j = jc;
			while (len < n) {
				i = (i + 1) % n;
				j = (j + 1) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++; } else break;
			}
			i = ic, j = jc;
			while (len < n) {
				i = (i - 1 + n) % n;
				j = (j - 1 + n) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++; } else break;
			}
			return len;
		}

		const diag = Array(n).fill(0);
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				if (a[i][j] == 1) {
					let d = i - j;
					if (d < 0) d += n;
					diag[d] += getLen(i, j);
				}
			}
		}
		const have = Math.max(...diag);

		console.log((n - have) + (ones - have));
	}
}

'use strict';
const readline = require('readline');
const util = require('util');
const lineReader = readline.createInterface({
    input: process.stdin,
});
let inputPos = 0;
const inputWords = [];
lineReader.on('line', (line) => {
    inputWords.push.apply(inputWords, line.split(' ').filter(s => s != ''));
});
lineReader.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(inputWords[inputPos++]));
}
function nextStr() {
    return inputWords[inputPos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const INF = 1000000000;
let n;
let a;
function solve() {
    let total = 0;
    for (let i = 0; i < n; i++) {
        for (let j = 0; j < n; j++) {
            if (a[i][j] == '1') {
                total++;
            }
        }
    }
    const diag = af(n).fill(0);
    for (let i = 0; i < n; i++) {
        for (let j = 0; j < n; j++) {
            let x = (i + j) % n;
            let y = j;
            // printf("diag %d (%d,%d)\n", i, x, y);
            if (a[y][x] == '1') {
                diag[i]++;
            }
        }
    }
    // printf("total %d\n", total);
    // printf("diag %j\n", diag);
    let ans = INF;
    for (let i = 0; i < n; i++) {
        ans = Math.min(ans, n - diag[i] + total - diag[i]);
    }
    return ans;
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        a = Array.from({ length: n });
        for (let i = 0; i < n; i++) {
            a[i] = nextStr();
        }
        printf("%d\n", solve());
    }
}

const fs = require('fs')
const inputs = fs.readFileSync(0, 'utf-8').split('\n')

function solve(n, matrix) {
  let count = new Array(n).fill(0)
  for (let i = 0; i < n; i++) {
    for (let j = 0; j < n; j++) {
      if (matrix[i][j] !== '1') continue
      let cur = (j - i + n) % n
      count[cur]++
    }
  }
  let max = Math.max(...count)
  return count.reduce((sum, a) => sum + a, 0) - max + (n - max)
}

void (function main() {
  let t = Number(inputs[0]),
    __ = 1,
    res = []
  for (let _ = 0; _ < t; _++) {
    __++
    const n = Number(inputs[__++])
    let matrix = []
    for (let i = 0; i < n; i++) {
      matrix.push(inputs[__++].trim())
    }
    res.push(solve(n, matrix))
  }
  console.log(res.join('\n'))
})()

const readline = require('readline')

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

function solve(n, grid) {
    // const up = []
    const down = []
    let total = 0
    for (let i = 0; i < n; i++) {
        // up[i] = []
        down[i] = []
        for (let j = 0; j < n; j++) {
            if (grid[i][j] === '1') total++
        }
    }
    // [n - 1, 0] to [0, n - 1]
    for (let d = n - 1; d >= -(n - 1); d--) {
        // for (let j = 0; j < n; j++) {
        //     const i = j + d
        //     if (i < 0 || i >= n) continue

        //     const prev = get(up, n, j - 1 + d, j - 1)
        //     const now = +grid[i][j]
        //     up[i][j] = prev + now
        // }
        for (let j = n - 1; j >= 0; j--) {
            const i = j + d
            if (i < 0 || i >= n) continue

            const prev = get(down, n, j + 1 + d, j + 1)
            const now = +grid[i][j]
            down[i][j] = prev + now
        }
    }
// console.log(up, down)
    //
    let ans = Infinity
    for (let i = 0; i < n; i++) {
        for (let j = 0; j < n; j++) {
            const d = i - j
            let a, b
            if (d >= 0) {
                a = get(down, n, d, 0) // [d, 0] to [n - 1, n - 1 - d]
                b = get(down, n, 0, n - 1 - d + 1)
            } else {
                a = get(down, n, 0, -d) // [0, -d] to [n - 1 + d, n - 1]
                b = get(down, n, n - 1 + d + 1, 0)
            }
            const now = a + b
            // console.log(now, a, b)
            ans = Math.min(n - now + total - now, ans)
        }
    }
    return ans
}
function get(grid, n, i, j) {
    if (i >= 0 && i < n && j >= 0 && j < n) return grid[i][j]
    return 0
}

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

module.exports = E;

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

const EPS = 1e-6;

const calc = (A, n)=>{
  let min = Infinity;
  let sum = 0;
  for (let i=0; i<n; i++){
    for (let j=0; j<n; j++){
      sum += A[i][j]
    }
  }
  const cnt_shift = (i, j)=>{
    let hits = 0;
    for (let k=0; k<n; k++){
      if (A[(i+k)%n][(j+k)%n])
        hits++;
    }
    let on_diagonal = n-hits;
    let beside_diagonal = sum-hits;
    return on_diagonal+beside_diagonal
  };
  for (let i=0; i<1; i++){
    for (let j=0; j<n; j++){
      let res = cnt_shift(i, j)
      if (res<min)
        min = res;
    }
  }
  return min;
};

function main() {
    let T = +readline();
    while (T--){
      readline();
      let n = +readline();
      let A = [];
      for (let i=0; i<n; i++){
        let s = readline();
        A.push(s.split('').map(a=>a=='1' ? 1 : 0));
      }
      print(calc(A, n))
    }
}

E.calc = calc;

var tests = parseInt(readline());
    for (var t=0; t < tests; t++) {
        var n = parseInt(readline());
        var mat = [];
        for (var i = 0; i < n; i++) {
            var row = readline().split('').map(x=>parseInt(x));
            mat.push(row);
        }
        //console.log(mat);
        var maxD = [0, 0];
        for (var i = 0; i < n; i++) {
            var ones = 0;
            var col = i;
            for (var r = 0; r < n; r++) {
                ones += mat[r][col];
                col = ( col + 1 ) % n;
            }
            if (ones > maxD[1]) {
                maxD = [i, ones];
            }
            if (ones == n) {
                break;
            }
        }
        var burls = 0;
        for (var r = 0; r < n; r++) {
            var off = (r + maxD[0]) % n;
            for (var c = 0; c < n; c++) {
                if (off == c) {
                    burls+=mat[r][c]^1;
                } else {
                    burls+=mat[r][c];
                }
            }
        }
        print(burls);
    }

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

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

function main () {
	let T = rn();
	while (T--) {
		rl();
		const n = rn();
		const a = [];
		for (let i = 0; i < n; i++) {
			a[i] = rl().split('').map(x => Number(x));
		}

		let ones = 0;
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				ones += a[i][j] == 1;
			}
		}

		function getLen (ic, jc) {
			let len = 1, i, j;
			i = ic, j = jc;
			while (len < n) {
				i = (i + 1) % n;
				j = (j + 1) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++; } else break;
			}
			i = ic, j = jc;
			while (len < n) {
				i = (i - 1 + n) % n;
				j = (j - 1 + n) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++; } else break;
			}
			return len;
		}

		const diag = Array(n).fill(0);
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				if (a[i][j] == 1) {
					diag[Math.abs(i - j)] += getLen(i, j);
				}
			}
		}
		const have = Math.max(...diag);

		console.log((n - have) + (ones - have));
	}
}

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

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

function main () {
	let T = rn();
	while (T--) {
		rl();
		const n = rn();
		const a = [];
		for (let i = 0; i < n; i++) {
			a[i] = rl().split('').map(x => Number(x));
		}

		let ones = 0;
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				ones += a[i][j] == 1;
			}
		}

		function getLen (ic, jc) {
			let len = 1, i, j;
			i = ic, j = jc;
			while (len < n) {
				i = (i + 1) % n;
				j = (j + 1) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++; } else break;
			}
			i = ic, j = jc;
			while (len < n) {
				i = (i - 1 + n) % n;
				j = (j - 1 + n) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++; } else break;
			}
			return len;
		}

		const diag = Array(2 * n).fill(0);
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				if (a[i][j] == 1) {
					diag[Math.abs(i - j + n)] += getLen(i, j);
				}
			}
		}
		const have = Math.max(...diag);

		console.log((n - have) + (ones - have));
	}
}

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

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

function main () {
	let T = rn();
	while (T--) {
		rl();
		const n = rn();
		const a = [];
		for (let i = 0; i < n; i++) {
			a[i] = rl().split('').map(x => Number(x));
		}

		let ones = 0;
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				ones += a[i][j] == 1;
			}
		}

		function getLen (ic, jc) {
			let len = 1, i, j;
			i = ic, j = jc;
			while (len < n) {
				i = (i + 1) % n;
				j = (j + 1) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++;} else break;
			}
			i = ic, j = jc;
			while (len < n) {
				i = (i - 1 + n) % n;
				j = (j - 1 + n) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++;} else break;
			}
			return len;
		}

		const diag = Array(2 * n).fill(0);
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				if (a[i][j] == 1) {
					diag[i - j + n] += getLen(i, j);
				}
			}
		}
		const have = Math.max(...diag);

		console.log((n - have) + (ones - have));
	}
}

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

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

function main () {
	let T = rn();
	while (T--) {
		rl();
		const n = rn();
		const a = [];
		for (let i = 0; i < n; i++) {
			a[i] = rl().split('').map(x => Number(x));
		}

		let ones = 0;
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				ones += a[i][j] == 1;
			}
		}

		function check (ic, jc) {
			let len = 1, i, j;
			i = ic, j = jc;
			while (len < n) {
				i = (i + 1) % n;
				j = (j + 1) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++;} else break;
			}
			i = ic, j = jc;
			while (len < n) {
				i = (i - 1 + n) % n;
				j = (j - 1 + n) % n;
				if (a[i][j] == 1) { a[i][j] = 2; len++;} else break;
			}
			return len;
		}

		let have = 0;
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				if (a[i][j] == 1) {
					have = Math.max(have, check(i, j));
				}
			}
		}

		const ans = n - have + (ones - have);

		console.log(ans);
	}
}


Ringo found a string $$$s$$$ of length $$$n$$$ in his yellow submarine. The string contains only lowercase letters from the English alphabet. As Ringo and his friends love palindromes, he would like to turn the string $$$s$$$ into a palindrome by applying two types of operations to the string. The first operation allows him to choose $$$i$$$ ($$$2 \le i \le n-1$$$) and to append the substring $$$s_2s_3 \ldots s_i$$$ ($$$i - 1$$$ characters) reversed to the front of $$$s$$$.The second operation allows him to choose $$$i$$$ ($$$2 \le i \le n-1$$$) and to append the substring $$$s_i s_{i + 1}\ldots s_{n - 1}$$$ ($$$n - i$$$ characters) reversed to the end of $$$s$$$.Note that characters in the string in this problem are indexed from $$$1$$$.For example suppose $$$s=$$$abcdef. If he performs the first operation with $$$i=3$$$ then he appends cb to the front of $$$s$$$ and the result will be cbabcdef. Performing the second operation on the resulted string with $$$i=5$$$ will yield cbabcdefedc.Your task is to help Ringo make the entire string a palindrome by applying any of the two operations (in total) at most $$$30$$$ times. The length of the resulting palindrome must not exceed $$$10^6$$$It is guaranteed that under these constraints there always is a solution. Also note you do not have to minimize neither the number of operations applied, nor the length of the resulting string, but they have to fit into the constraints.

The only line contains the string $$$S$$$ ($$$3 \le |s| \le 10^5$$$) of lowercase letters from the English alphabet.

The first line should contain $$$k$$$ ($$$0\le k \le 30$$$)  — the number of operations performed. Each of the following $$$k$$$ lines should describe an operation in form L i or R i. $$$L$$$ represents the first operation, $$$R$$$ represents the second operation, $$$i$$$ represents the index chosen. The length of the resulting palindrome must not exceed $$$10^6$$$.

NoteFor the first example the following operations are performed:abac $$$\to$$$ abacab $$$\to$$$ abacabaThe second sample performs the following operations: acccc $$$\to$$$ cccacccc $$$\to$$$ ccccaccccThe third example is already a palindrome so no operations are required.

var str = readline();
print(3);
print('L 2');
print('R 2');
print('R', (str.length*2)-1);