You are given two integers $$$a$$$ and $$$b$$$. In one turn, you can do one of the following operations:   Take an integer $$$c$$$ ($$$c > 1$$$ and $$$a$$$ should be divisible by $$$c$$$) and replace $$$a$$$ with $$$\frac{a}{c}$$$;  Take an integer $$$c$$$ ($$$c > 1$$$ and $$$b$$$ should be divisible by $$$c$$$) and replace $$$b$$$ with $$$\frac{b}{c}$$$. Your goal is to make $$$a$$$ equal to $$$b$$$ using exactly $$$k$$$ turns.For example, the numbers $$$a=36$$$ and $$$b=48$$$ can be made equal in $$$4$$$ moves:   $$$c=6$$$, divide $$$b$$$ by $$$c$$$ $$$\Rightarrow$$$ $$$a=36$$$, $$$b=8$$$;  $$$c=2$$$, divide $$$a$$$ by $$$c$$$ $$$\Rightarrow$$$ $$$a=18$$$, $$$b=8$$$;  $$$c=9$$$, divide $$$a$$$ by $$$c$$$ $$$\Rightarrow$$$ $$$a=2$$$, $$$b=8$$$;  $$$c=4$$$, divide $$$b$$$ by $$$c$$$ $$$\Rightarrow$$$ $$$a=2$$$, $$$b=2$$$. For the given numbers $$$a$$$ and $$$b$$$, determine whether it is possible to make them equal using exactly $$$k$$$ turns.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$). Then $$$t$$$ test cases follow. Each test case is contains three integers $$$a$$$, $$$b$$$ and $$$k$$$ ($$$1 \le a, b, k \le 10^9$$$).

For each test case output:    "Yes", if it is possible to make the numbers $$$a$$$ and $$$b$$$ equal in exactly $$$k$$$ turns;  "No" otherwise.  The strings "Yes" and "No" can be output in any case.

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

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

function div(a, b) {
   return Math.floor(a / b);
}

var erat = [];
var pArr = [];
function fillErat() {
   for (var i = 2; i <= Math.floor(Math.sqrt(1000000000)); i++) {
      if (erat[i]) {
         continue;
      }
      pArr.push(i);
      for (var j = i * 2; j <= Math.floor(Math.sqrt(1000000000)); j += i) {
         erat[j] = 1;
      }
   }
}
fillErat();

function solve() {
   var abk = readArray(Number);
   var a = abk[0];
   var b = abk[1];
   var canDiv = a % b === 0 || b % a === 0;
   var isEqual = a === b;
   var k = abk[2];
   var maxAns = 0;
   var i = 0;
   while(a !== 1) {
      if (i >= pArr.length) {
         maxAns++;
         break;
      }
      while(a % pArr[i] === 0) {
         maxAns++;
         a = div(a, pArr[i]);
      }
      i++;
   }
   var i = 0;
   while(b !== 1) {
      if (i >= pArr.length) {
         maxAns++;
         break;
      }
      while(b % pArr[i] === 0) {
         maxAns++;
         b = div(b, pArr[i]);
      }
      i++;
   }
   if (k === 1) {
      write(canDiv && !isEqual ? 'YES' : 'NO');
      return;
   }
   if (maxAns < k) {
      write('NO');
      return;
   }
   write('YES');
}

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

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

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

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

   var inTextName;
   var outTextName;

   var needWriteFile = false;

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

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

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

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

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

function div(a, b) {
   return Math.floor(a / b);
}

var erat = [];
var pArr = [];
function fillErat() {
   for (var i = 2; i < 100000; i++) {
      if (erat[i]) {
         continue;
      }
      pArr.push(i);
      for (var j = i * 2; j < 100000; j += i) {
         erat[j] = 1;
      }
   }
}
fillErat();

function solve() {
   var abk = readArray(Number);
   var a = abk[0];
   var b = abk[1];
   var canDiv = a % b === 0 || b % a === 0;
   var isEqual = a === b;
   var k = abk[2];
   var maxAns = 0;
   var i = 0;
   while(a !== 1) {
      if (i >= pArr.length) {
         maxAns++;
         break;
      }
      while(a % pArr[i] === 0) {
         maxAns++;
         a = div(a, pArr[i]);
      }
      i++;
   }
   var i = 0;
   while(b !== 1) {
      if (i >= pArr.length) {
         maxAns++;
         break;
      }
      while(b % pArr[i] === 0) {
         maxAns++;
         b = div(b, pArr[i]);
      }
      i++;
   }
   if (k === 1) {
      write(canDiv && !isEqual ? 'YES' : 'NO');
      return;
   }
   if (maxAns < k) {
      write('NO');
      return;
   }
   write('YES');
}

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

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

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

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

   var inTextName;
   var outTextName;

   var needWriteFile = false;

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

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

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

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

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

function div(a, b) {
   return Math.floor(a / b);
}

var erat = [];
var pArr = [];
function fillErat() {
   for (var i = 2; i < 100000; i++) {
      if (erat[i]) {
         continue;
      }
      pArr.push(i);
      for (var j = i * 2; j < 100000; j += i) {
         erat[j] = 1;
      }
   }
}
fillErat();

function solve() {
   var abk = readArray(Number);
   var a = abk[0];
   var b = abk[1];
   var canDiv = a % b === 0 || b % a === 0;
   var isEqual = a === b;
   var k = abk[2];
   var maxAns = 0;
   var i = 0;
   while(a !== 1) {
      if (i >= pArr.length) {
         maxAns++;
         break;
      }
      while(a % pArr[i] === 0) {
         maxAns++;
         a = div(a, pArr[i]);
      }
      i++;
   }
   var i = 0;
   while(b !== 1) {
      if (i >= pArr.length) {
         maxAns++;
         break;
      }
      while(b % pArr[i] === 0) {
         maxAns++;
         b = div(b, pArr[i]);
      }
      i++;
   }
   if (k === 1) {
      write(canDiv && !isEqual ? 'YES' : 'NO');
      return;
   }
   if (k === 2) {
      write(maxAns >= 2 && maxAns >= 2 ? 'YES' : 'NO');
      return;
   }
   if (maxAns < k) {
      write('NO');
      return;
   }
   write('YES');
}

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

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

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

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

   var inTextName;
   var outTextName;

   var needWriteFile = false;

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

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

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

'use strict';

const primes = new Set(getPrimes(10 ** 5));
function solve(n, m, k) {
  if (k === 1) return (n % m === 0 || m % n === 0) && n !== m ? 'YES' : 'NO';
  let a = 0,
      b = 0;
  for (let num of primes) {
    if (num > n && num > m) break;
    while (n % num === 0) {
      a++;
      n /= num;
    }
    while (m % num === 0) {
      b++;
      m /= num;
    }
    if (a + b >= k) return 'YES';
  }
  if (n > 1 && !primes.has(n)) a++;
  if (m > 1 && !primes.has(m)) b++;
  if (a + b >= k) return 'YES';
  return 'NO';
}
function getPrimes(n) {
  const nums = new Array(n + 1).fill(1);
  nums[0] = nums[1] = 0;
  const primes = [];
  for (let i = 2; i <= n; i++) {
    if (nums[i]) primes.push(i);
    for (let num of primes) {
      const j = num * i;
      if (j > n) break;
      nums[j] = 0;
      if (i % num === 0) break;
    }
  }
  return primes;
}

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

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

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        console.log(solve(lines[l++].split(' ').map(Number)));
    }
});

const PRIMES = primes(Math.ceil(Math.sqrt(1e9)))
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
function solve([a, b, k]) {
    return isOK(a, b, k) ? 'YES' : 'NO'
}

function isOK(a, b, k) {
    const g = gcd(a, b)
    const n1 = getFactorCount(a / g)
    const n2 = getFactorCount(b / g)
    const n = getFactorCount(g)

    const divided = a === g || b === g
    if (a === b) {
        const min = 0
        const max = 2 * n
        return k >= min && k <= max && k !== 1
    } else if (divided) {
        const min = 1
        const max = n1 + n2 + 2 * n
        return k >= min && k <= max
    } else {
        const min = 2
        const max = n1 + n2 + 2 * n
        return k >= min && k <= max
    }
}
function getFactorCount(n) {
    if (n < 2) return 0

    let c = 0
    let x = n
    PRIMES.some(p => {
        while (!(x % p)) {
            c++
            x /= p
        }
        if (p >= x) return true
    })
    if (x !== 1) c++ // the last non-divided big prime
    return c
}

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

    while (a) {
        const r = b % a
        b = a
        a = r
    }
    return b
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.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(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let a;
let b;
let k;
const MAX = 50000;
let primes = [];
let sieve = new Int32Array(MAX).fill(0);
function precalc() {
    sieve[1] = 1;
    for (let i = 2; i < MAX; i++) {
        if (sieve[i] == 0) {
            sieve[i] = i;
            primes.push(i);
            for (let j = i; i * j < MAX; j++) {
                sieve[i * j] = i;
            }
        }
    }
    //  console.log(primes);
}
function npf(x) {
    let rv = 0;
    for (let p of primes) {
        if (p > x) {
            break;
        }
        while ((x % p) == 0) {
            rv++;
            x /= p;
        }
    }
    if (x > 1) { // x included a large prime
        rv++;
    }
    return rv;
}
function gcd(a, b) {
    while (a > 0) {
        let c = a;
        a = b % a;
        b = c;
    }
    return b;
}
function solve() {
    // printf("npf(%d) %d\n", a, npf(a));
    // printf("npf(%d) %d\n", b, npf(b));
    let g = gcd(a, b);
    if (k == 1) {
        if (a == b) {
            return false;
        }
        return a == g || b == g;
    }
    let mx = npf(a) + npf(b);
    if (k > mx) {
        return false;
    }
    return true;
}
function main() {
    let tc = nextInt();
    precalc();
    check(npf(1000000007) == 1);
    while (tc-- > 0) {
        a = nextInt();
        b = nextInt();
        k = nextInt();
        if (solve()) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
}

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

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

function div(a, b) {
   return Math.floor(a / b);
}

var erat = [];
var pArr = [];
function fillErat() {
   for (var i = 2; i < 100000; i++) {
      if (erat[i]) {
         continue;
      }
      pArr.push(i);
   }
}
fillErat();

function solve() {
   var abk = readArray(Number);
   var a = abk[0];
   var b = abk[1];
   var canDiv = a % b === 0 || b % a === 0;
   var isEqual = a === b;
   var k = abk[2];
   var parra = [0, 0];
   var parrb = [0, 0];
   var i = 2;
   while(a !== 1) {
      parra[i] = 0;
      while(a % i === 0) {
         parra[i]++;
         a = div(a, i);
      }
      i++;
   }
   var i = 2;
   while(b !== 1) {
      parrb[i] = 0;
      while(b % i === 0) {
         parrb[i]++;
         b = div(b, i);
      }
      i++;
   }
   while (parra.length < parrb.length) {
      parra.push(0);
   }
   while (parrb.length < parra.length) {
      parrb.push(0);
   }
   var maxAns = 0;
   var minAns = 0;
   for (var i = 0; i < parrb.length; i++) {
      minAns += Math.abs(parrb[i] - parra[i]);
      maxAns += parra[i] + parrb[i];
   }
   if (k === 1) {
      write(canDiv && !isEqual ? 'YES' : 'NO');
      return;
   }
   if (k === 2) {
      write(maxAns >= 2 && maxAns >= 2 ? 'YES' : 'NO');
      return;
   }
   if (minAns > k || maxAns < k) {
      write('NO');
      return;
   }
   write('YES');
}

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

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

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

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

   var inTextName;
   var outTextName;

   var needWriteFile = false;

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

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

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

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

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

function div(a, b) {
   return Math.floor(a / b);
}

var erat = [];
var pArr = [];
function fillErat() {
   for (var i = 2; i < 100000; i++) {
      if (erat[i]) {
         continue;
      }
      pArr.push(i);
   }
}
fillErat();

function solve() {
   var abk = readArray(Number);
   var a = abk[0];
   var b = abk[1];
   var canDiv = a % b === 0 || b % a === 0;
   var isEqual = a === b;
   var k = abk[2];
   var parra = [0, 0];
   var parrb = [0, 0];
   var i = 2;
   while(a !== 1) {
      parra[i] = 0;
      while(a % i === 0) {
         parra[i]++;
         a = div(a, i);
      }
      i++;
   }
   var i = 2;
   while(b !== 1) {
      parrb[i] = 0;
      while(b % i === 0) {
         parrb[i]++;
         b = div(b, i);
      }
      i++;
   }
   while (parra.length < parrb.length) {
      parra.push(0);
   }
   while (parrb.length < parra.length) {
      parrb.push(0);
   }
   var maxAns = 0;
   var minAns = 0;
   for (var i = 0; i < parrb.length; i++) {
      minAns += Math.abs(parrb[i] - parra[i]);
      maxAns += parra[i] + parrb[i];
   }
   if (k === 1) {
      write(canDiv && !isEqual ? 'YES' : 'NO');
      return;
   }
   if (k === 2) {
      write(maxAns >= 2 && maxAns >= 2 ? 'YES' : 'NO');
      return;
   }
   if (minAns > k || maxAns < k) {
      write('NO');
      return;
   }
   if (isEqual) {
      write((k & 1) ? 'NO' : 'YES');
      return;
   }
   write('YES');
}

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

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

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

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

   var inTextName;
   var outTextName;

   var needWriteFile = false;

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

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

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

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

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

function div(a, b) {
   return Math.floor(a / b);
}

var erat = [];
var pArr = [];
function fillErat() {
   for (var i = 2; i < 100000; i++) {
      if (erat[i]) {
         continue;
      }
      pArr.push(i);
   }
}
fillErat();

function solve() {
   var abk = readArray(Number);
   var a = abk[0];
   var b = abk[1];
   var minAns = a % b === 0 || b % a === 0 ? 1 : 2;
   var isEqual = a === b;
   var k = abk[2];
   var parra = [0, 0];
   var parrb = [0, 0];
   var i = 2;
   while(a !== 1) {
      parra[i] = 0;
      while(a % i === 0) {
         parra[i]++;
         a = div(a, i);
      }
      i++;
   }
   var i = 2;
   while(b !== 1) {
      parrb[i] = 0;
      while(b % i === 0) {
         parrb[i]++;
         b = div(b, i);
      }
      i++;
   }
   while (parra.length < parrb.length) {
      parra.push(0);
   }
   while (parrb.length < parra.length) {
      parrb.push(0);
   }
   var maxAns = 0;
   for (var i = 0; i < parrb.length; i++) {
      maxAns += parra[i] + parrb[i];
   }
   if (minAns > k || maxAns < k) {
      write('NO');
      return;
   }
   if (isEqual) {
      write((k & 1) ? 'NO' : 'YES');
      return;
   }
   write('YES');
}

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

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

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

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

   var inTextName;
   var outTextName;

   var needWriteFile = false;

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

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

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

'use strict';

const primes = new Set(getPrimes(10 ** 5));
function solve(n, m, k) {
  if (k === 1) return (n % m === 0 || m % n === 0) && n !== m ? 'YES' : 'NO';
  let a = 0,
      b = 0;
  for (let num of primes) {
    if (num > n && num > m) break;
    while (n % num === 0) {
      a++;
      n /= num;
    }
    while (m % num === 0) {
      b++;
      m /= num;
    }
    if (a + b >= k) return 'YES';
  }
  if (n > 1 && !primes.has(n)) a++;
  if (n > 1 && !primes.has(m)) b++;
  if (a + b >= k) return 'YES';
  return 'NO';
}
function getPrimes(n) {
  const nums = new Array(n + 1).fill(1);
  nums[0] = nums[1] = 0;
  const primes = [];
  for (let i = 2; i <= n; i++) {
    if (nums[i]) primes.push(i);
    for (let num of primes) {
      const j = num * i;
      if (j > n) break;
      nums[j] = 0;
      if (i % num === 0) break;
    }
  }
  return primes;
}

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

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

'use strict';

const primes = new Set(getPrimes(10 ** 5));
function solve(n, m, k) {
  if (k > 1000) return 'NO';
  if (k === 1) return (n % m === 0 || m % n === 0) && n !== m ? 'YES' : 'NO';
  let a = 0,
      b = 0;
  for (let num of primes) {
    while (n % num === 0) {
      a++;
      n /= num;
    }
    while (m % num === 0) {
      b++;
      m /= num;
    }
    if (a + b >= k) return 'YES';
  }
  if (!primes.has(n)) a++;
  if (!primes.has(m)) b++;
  if (a + b >= k) return 'YES';
  return 'NO';
}
function getPrimes(n) {
  const nums = new Array(n + 1).fill(1);
  nums[0] = nums[1] = 0;
  const primes = [];
  for (let i = 2; i <= n; i++) {
    if (nums[i]) primes.push(i);
    for (let num of primes) {
      const j = num * i;
      if (j > n) break;
      nums[j] = 0;
      if (i % num === 0) break;
    }
  }
  return primes;
}

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

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

'use strict';

function solve(n, m, k) {
  if (n === m && k & 1) return 'NO';
  if (k === 1) return (n % m === 0 || m % n === 0) && n !== m ? 'YES' : 'NO';
  const count = n => {
    if (n === 2) return 1;
    let res = 0;
    for (let i = 2; i <= n; i++) {
      while (n % i === 0) {
        res++;
        n /= i;
      }
    }
    return res;
  };
  let max = count(n) + count(m);
  if (k > max) return 'NO';
  return 'YES';
}

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

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

'use strict';

function solve(n, m, k) {
  if (n === m && k & 1) return 'NO';
  if (k === 1) return (n % m === 0 || m % n === 0) && n !== m ? 'YES' : 'NO';
  const count = n => {
    if (n === 2) return 1;
    let res = 0;
    for (let i = 2; i <= n / i; i++) {
      while (n % i === 0) {
        res++;
        n /= i;
      }
    }
    return res;
  };
  let max = count(n) + count(m);
  if (k > max) return 'NO';
  return 'YES';
}

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

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

'use strict';

function solve(n, m, k) {
  if (k === 1) return (n % m === 0 || m % n === 0) && n !== m ? 'YES' : 'NO';
  const count = n => {
    if (n === 2) return 1;
    let res = 0;
    for (let i = 2; i <= n / i; i++) {
      while (n % i === 0) {
        res++;
        n /= i;
      }
    }
    return res;
  };
  let max = count(n) + count(m);
  return k <= max ? 'YES' : 'NO';
}

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

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

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        console.log(solve(lines[l++].split(' ').map(Number)));
    }
});

const PRIMES = primes(Math.ceil(Math.sqrt(1e9)))
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
function solve([a, b, k]) {
    return isOK(a, b, k) ? 'YES' : 'NO'
}

function isOK(a, b, k) {
    const g = gcd(a, b)
    const n1 = getFactorCount(a / g)
    const n2 = getFactorCount(b / g)
    const n = getFactorCount(g)
    console.log(a, b, g, '-', n1, n2, n)

    const divided = a === g || b === g
    if (a === b) {
        const min = 0
        const max = 2 * n
        return k >= min && k <= max && k !== 1
    } else if (divided) {
        const min = 1
        const max = n1 + n2 + 2 * n
        return k >= min && k <= max
    } else {
        const min = 2
        const max = n1 + n2 + 2 * n
        return k >= min && k <= max
    }
}
function getFactorCount(n) {
    if (n < 2) return 0

    let c = 0
    let x = n
    PRIMES.some(p => {
        while (!(x % p)) {
            c++
            x /= p
        }
        if (p >= x) return true
    })
    if (x !== 1) c++ // the last non-divided big prime
    return c
}

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

    while (a) {
        const r = b % a
        b = a
        a = r
    }
    return b
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        console.log(solve(lines[l++].split(' ').map(Number)));
    }
});

const PRIMES = primes(Math.ceil(Math.sqrt(1e9)))
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
function solve([a, b, k]) {
    return isOK(a, b, k) ? 'YES' : 'NO'
}

function isOK(a, b, k) {
    const g = gcd(a, b)
    const n1 = getFactorCount(a / g)
    const n2 = getFactorCount(b / g)
    const n = getFactorCount(g)

    const divided = a === g || b === g
    if (a === b) {
        const min = 0
        const max = 2 * n
        return k >= min && k <= max && k !== 1
    } else if (divided) {
        const min = 1
        const max = n1 + n2 + 2 * n
        return k >= min && k <= max
    } else {
        const min = 2
        const max = n1 + n2 + 2 * n
        return k >= min && k <= max
    }
}
function getFactorCount(n) {
    if (n < 2) return 0

    let c = 0
    let x = n
    PRIMES.some(p => {
        while (!(x % p)) {
            c++
            x /= p
        }
        if (p >= x) return true
    })
    if (c !== 1) c++ // the last non-divided big prime
    return c
}

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

    while (a) {
        const r = b % a
        b = a
        a = r
    }
    return b
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        console.log(solve(lines[l++].split(' ').map(Number)));
    }
});

const PRIMES = primes(1e5)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        if (!flag[i]) continue
        for (let j = i * 2; j <= n; j += i) {
            flag[j] = false
        }
    }

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
function solve([a, b, k]) {
    return isOK(a, b, k) ? 'YES' : 'NO'
}

function isOK(a, b, k) {
    const g = gcd(a, b)
    const n1 = getFactorCount(a / g)
    const n2 = getFactorCount(b / g)
    const n = getFactorCount(g)

    const divided = a === g || b === g
    if (a === b) {
        const min = 0
        const max = 2 * n
        return k >= min && k <= max && k !== 1
    } else if (divided) {
        const min = 1
        const max = n1 + n2 + 2 * n
        return k >= min && k <= max
    } else {
        const min = 2
        const max = n1 + n2 + 2 * n
        return k >= min && k <= max
    }
}
function getFactorCount(n) {
    if (n < 2) return 0

    let c = 0
    let x = n
    PRIMES.some(p => {
        while (!(x % p)) {
            c++
            x /= p
        }
        if (p >= x) return true
    })
    return c
}

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

    while (a) {
        const r = b % a
        b = a
        a = r
    }
    return b
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        console.log(solve(lines[l++].split(' ').map(Number)));
    }
});

const PRIMES = primes(1e5)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        if (!flag[i]) continue
        for (let j = i * 2; j <= n; j += i) {
            flag[j] = false
        }
    }

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
function solve([a, b, k]) {
    return isOK(a, b, k) ? 'YES' : 'NO'
}

function isOK(a, b, k) {
    const g = gcd(a, b)
    const n1 = getFactorCount(a / g)
    const n2 = getFactorCount(b / g)
    const n = getFactorCount(g)

    const divided = a === g || b === g
    if (k <= n1 + n2) {
        if (divided) {
            // [1, n1 + n2]
            return k >= 1
        } else {
            // [2, n1 + n2]
            return k >= 2
        }
    }

    k -= (n1 + n2) // greedy
    if (k & 1) {
        const k2 = n1 + n2 - 1
        if (divided && k2 < 1 || k2 < 2) return false
        k++
    }
    return !(k & 1) && k <= 2 * n
}
function getFactorCount(n) {
    if (n < 2) return 0

    let c = 0
    let x = n
    PRIMES.some(p => {
        while (!(x % p)) {
            c++
            x /= p
        }
        if (p >= x) return true
    })
    return c
}

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

    while (a) {
        const r = b % a
        b = a
        a = r
    }
    return b
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        console.log(solve(lines[l++].split(' ').map(Number)));
    }
});

const PRIMES = primes(1e7)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        if (!flag[i]) continue
        for (let j = i * 2; j <= n; j += i) {
            flag[j] = false
        }
    }

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
function solve([a, b, k]) {
    return isOK(a, b, k) ? 'YES' : 'NO'
}

function isOK(a, b, k) {
    if (a === b) {
        const n = getFactorCount(a)
        return !(k & 1) && n >= 2 * k
    }

    const g = gcd(a, b)
    if (g === 1) {
        if (a === 1 || b === 1) return k === 1
        return k === 2
    } else {
        const n1 = getFactorCount(a / g)
        const n2 = getFactorCount(b / g)
        const n = getFactorCount(g)
        if (a === g || b === g) {
            return k <= n1 + n2 + n
        }
        return k >= 2 && k <= n1 + n2 + n
    }
}
function getFactorCount(n) {
    if (n < 2) return 0

    let c = 0
    let x = n
    PRIMES.some(p => {
        while (!(x % p)) {
            c++
            x /= p
        }
        if (p >= x) return true
    })
    return c
}

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

    while (a) {
        const r = b % a
        b = a
        a = r
    }
    return b
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.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(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let a;
let b;
let k;
const MAX = 50000;
let primes = [];
let sieve = new Int32Array(MAX).fill(0);
function precalc() {
    sieve[1] = 1;
    for (let i = 2; i < MAX; i++) {
        if (sieve[i] == 0) {
            sieve[i] = i;
            primes.push(i);
            for (let j = i; i * j < MAX; j++) {
                sieve[i * j] = i;
            }
        }
    }
    //  console.log(primes);
}
function npf(x) {
    let rv = 0;
    for (let p of primes) {
        if (p > x) {
            break;
        }
        while ((x % p) == 0) {
            rv++;
            x /= p;
        }
    }
    if (x > 1) { // x was a large prime
        return 1;
    }
    return rv;
}
function gcd(a, b) {
    while (a > 0) {
        let c = a;
        a = b % a;
        b = c;
    }
    return b;
}
function solve() {
    // printf("npf(%d) %d\n", a, npf(a));
    // printf("npf(%d) %d\n", b, npf(b));
    let g = gcd(a, b);
    if (k == 1) {
        if (a == b) {
            return false;
        }
        return a == g || b == g;
    }
    let mx = npf(a) + npf(b);
    if (k > mx) {
        return false;
    }
    return true;
}
function main() {
    let tc = nextInt();
    precalc();
    check(npf(1000000007) == 1);
    while (tc-- > 0) {
        a = nextInt();
        b = nextInt();
        k = nextInt();
        if (solve()) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.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(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let a;
let b;
let k;
const MAX = 50000;
let primes = [];
let sieve = new Int32Array(MAX).fill(0);
function precalc() {
    sieve[1] = 1;
    for (let i = 2; i < MAX; i++) {
        if (sieve[i] == 0) {
            sieve[i] = i;
            primes.push(i);
            for (let j = i; i * j < MAX; j++) {
                sieve[i * j] = i;
            }
        }
    }
    //  console.log(primes);
}
function npf(x) {
    let rv = 0;
    for (let p of primes) {
        if (p > x) {
            break;
        }
        while ((x % p) == 0) {
            rv++;
            x /= p;
        }
    }
    if (x > 1) { // x was a large prime
        return 1;
    }
    return rv;
}
function gcd(a, b) {
    while (a > 0) {
        let c = a;
        a = b % a;
        b = c;
    }
    return b;
}
function solve() {
    // printf("npf(%d) %d\n", a, npf(a));
    // printf("npf(%d) %d\n", b, npf(b));
    let g = gcd(a, b);
    if (k == 1) {
        if (a == b) {
            return false;
        }
        return a == g || b == g;
    }
    let mx = npf(a) + npf(b);
    if (k > mx) {
        return false;
    }
    if ((k % 2) == 1) {
        a /= g;
        b /= g;
        return npf(a) != npf(b);
    }
    return true;
}
function main() {
    let tc = nextInt();
    precalc();
    check(npf(1000000007) == 1);
    while (tc-- > 0) {
        a = nextInt();
        b = nextInt();
        k = nextInt();
        if (solve()) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
}


The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$$1$$$. Let's name it as $$$2n$$$-gon.Your task is to find the square of the minimum size such that you can embed $$$2n$$$-gon in the square. Embedding $$$2n$$$-gon in the square means that you need to place $$$2n$$$-gon in the square in such way that each point which lies inside or on a border of $$$2n$$$-gon should also lie inside or on a border of the square.You can rotate $$$2n$$$-gon and/or the square.

The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.

Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.

function Main() {
  var A = Number(readline());
  for(var i=0;i<A;i++){
    var r = 1/(2*Math.sin(Math.PI/(2*Number(readline()))));
    var t = Math.sqrt(r*r - 0.25);
    print(t*2);
  }
}
Main();

const readline = require('readline');
const input = [];
function A(q) {
    for (let i = 1; i <= Number(q[0]); i++) {
        console.log(solve(q[i]))
    }
}
function solve(n) {
    const ang1 = Math.PI / n;
    const R = 0.5 / Math.sin(ang1 / 2);
    const shift = Math.PI / (2*n);
    let xl = Number.MAX_VALUE;
    let yb = Number.MAX_VALUE;
    let xr = Number.MIN_VALUE;
    let yt = Number.MIN_VALUE;
    for (let i = 0; i < n; i++) {
        const x = Math.cos(Math.PI / n * i + shift);
        const y = Math.sin(Math.PI / n * i + shift);
        xl = Math.min(xl, x);
        xr = Math.max(xr, x);
        yb = Math.min(yb, y);
        yt = Math.max(yt, y);
    }
    const side = Math.max(xr - xl, yt - yb) * R;
    return side.toPrecision(10);
}
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
rl.on('line', q => {
    input.push(q.trim())
});
rl.on('close', () => {
    A(input);
})


You are given a binary string $$$s$$$ consisting of $$$n$$$ zeros and ones.Your task is to divide the given string into the minimum number of subsequences in such a way that each character of the string belongs to exactly one subsequence and each subsequence looks like "010101 ..." or "101010 ..." (i.e. the subsequence should not contain two adjacent zeros or ones).Recall that a subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements. For example, subsequences of "1011101" are "0", "1", "11111", "0111", "101", "1001", but not "000", "101010" and "11100".You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of $$$s$$$. The second line of the test case contains $$$n$$$ characters '0' and '1' — the string $$$s$$$. It is guaranteed that the sum of $$$n$$$ does not exceed $$$2 \cdot 10^5$$$ ($$$\sum n \le 2 \cdot 10^5$$$).

For each test case, print the answer: in the first line print one integer $$$k$$$ ($$$1 \le k \le n$$$) — the minimum number of subsequences you can divide the string $$$s$$$ to. In the second line print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le k$$$), where $$$a_i$$$ is the number of subsequence the $$$i$$$-th character of $$$s$$$ belongs to. If there are several answers, you can print any.

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    let len = +readLine();
    const str = readLine();
    const patternEndsWith0 = [];
    const patternEndsWith1 = [];
    const result = [];

    for (let i = 0; i < len; i++) {
      const char = str[i];
      const patternCount = patternEndsWith0.length + patternEndsWith1.length + 1;
      if (char === "0") {
        if (patternEndsWith1.length > 0) {
          const pattern = patternEndsWith1.pop();
          patternEndsWith0.push(pattern);
          result.push(pattern);
        } else {
          patternEndsWith0.push(patternCount);
          result.push(patternCount);
        }
      } else {
        if (char === "1") {
          if (patternEndsWith0.length > 0) {
            const pattern = patternEndsWith0.pop();
            patternEndsWith1.push(pattern);
            result.push(pattern);
          } else {
            patternEndsWith1.push(patternCount);
            result.push(patternCount);
          }
        }
      }
    }
    console.log(patternEndsWith0.length + patternEndsWith1.length);
    console.log(result.join(" "));
  }
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(2 * t);
  for(var i = 0; i < t; i++){
    var N = nextInt();
    var list = nextCharArray();
    var out = new Array(N);
    out[0] = 1;
    var lastOne = [];
    var lastZero = [];
    if(list[0] == "1"){
      lastOne.push(1);
    }else{
      lastZero.push(1);
    }
    for(var j = 1; j < N; j++){
      if(list[j] == "1"){
        if(lastZero.length != 0){
          var tmplist = lastZero.pop();
          lastOne.push(tmplist);
          out[j] = tmplist;
        }else{
          lastOne.push(lastOne.length + 1);
          out[j] = lastOne.length;
        }
      }else{
        if(lastOne.length != 0){
          var tmplist = lastOne.pop();
          lastZero.push(tmplist);
          out[j] = tmplist;
        }else{
          lastZero.push(lastZero.length + 1);
          out[j] = lastZero.length;
        }
      }
    }
    output[i * 2] = lastOne.length + lastZero.length;
    output[i * 2 + 1] = myconv(out, 8);
  }
  myout(myconv(output, 9));
}

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

let inputString = ''
let currentLine = 0

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

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n')

    main()
})

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

const s2i = s => parseInt(s, 10)

const readLineOfBigInts = () => {
  const split = readLine().split(' ')
  const result = []
  for (let i = 0, l = split.length; i < l; i++) {
    result.push(BigInt(split[i]));
  }
  return result
}

function main() {
  let T = s2i(readLine())
  let out = ''

  while (T--) {
    const n = s2i(readLine())
    const s = readLine()

    let c0 = []
    let c1 = []
    let next = 1
    let moves = []

    for (let i = 0, seq, from, to; i < n; i++) {
      if (s.charAt(i) === '0') {
        from = c1
        to = c0
      } else {
        from = c0
        to = c1
      }

      if (from.length) {
        seq = from.pop()
      } else {
        seq = next++
      }
      to.push(seq)

      moves.push(seq)
    }

    out += (c0.length + c1.length) + '\n'
    out += moves.join(' ') + '\n'
  }

  console.log(out)
}

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main(){
    let t = parseInt(readline());
    for(let k = 0; k < t; k++){
        let n = parseInt(readline());
        if(n === 0){
            console.log(0);
            console.log();
            continue;
        }
        let arr = readline().split('');
        let res = new Array(arr.length);
        let hMap = {'0': [], '1': []};
        let count = 0;
        for(let i = 0; i < arr.length; i++){
            if(arr[i] === '0'){
                if(hMap['0'].length > 0){
                    let index = hMap['0'].pop();
                    res[i] = index;
                    hMap['1'].push(index);
                }
                else{
                    hMap['1'].push(++count);
                    res[i] = count;
                }
            }else{
                if(hMap['1'].length > 0){
                    let index = hMap['1'].pop();
                    res[i] = index;
                    hMap['0'].push(index);
                }else{
                    hMap['0'].push(++count);
                    res[i] = count;
                }
            }
        }
        console.log(count);
        for(num of res)
            console.log(num);
    }
}

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    let len = +readLine();
    const str = readLine();
    const patternEndsWith0 = [];
    const patternEndsWith1 = [];
    const result = [];

    for (let i = 0; i < len; i++) {
      const char = str[i];
      const patternCount = patternEndsWith0.length + patternEndsWith1.length + 1;
      if (char === "0") {
        if (patternEndsWith1.length > 0) {
          const pattern = patternEndsWith1.pop();
          patternEndsWith0.push(pattern);
          result.push(pattern);
        } else {
          patternEndsWith0.push(patternCount);
          result.push(patternCount);
        }
      } else {
        if (char === "1") {
          if (patternEndsWith0.length > 0) {
            const pattern = patternEndsWith0.pop();
            patternEndsWith1.push(pattern);
            result.push(pattern);
          } else {
            patternEndsWith1.push(patternCount);
            result.push(patternCount);
          }
        }
      }
    }
    console.log(result.join(" "));
  }
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(2 * t);
  for(var i = 0; i < t; i++){
    var N = nextInt();
    var list = nextCharArray();
    var map = {
      1 : list[0]
    };
    var out = new Array(N);
    out[0] = 1;
    var lastOne = new Set();
    var lastZero = new Set();
    if(list[0] == "1"){
      lastOne.add(1);
    }else{
      lastZero.add(1);
    }
    for(var j = 1; j < N; j++){
      var keys = Object.keys(map);
      var isOK = false;
      if(list[j] == "1"){
        if(lastZero.size != 0){
          var tmplist = Array.from(lastZero);
          lastZero.delete(tmplist[0]);
          lastOne.add(tmplist[0]);
          out[j] = tmplist[0];
        }else{
          lastOne.add(lastOne.size + 1);
          out[j] = lastOne.size;
        }
      }else{
        if(lastOne.size != 0){
          var tmplist = Array.from(lastOne);
          lastOne.delete(tmplist[0]);
          lastZero.add(tmplist[0]);
          out[j] = tmplist[0];
        }else{
          lastZero.add(lastZero.size + 1);
          out[j] = lastZero.size;
        }
      }
    }
    output[i * 2] = Object.keys(map).length;
    output[i * 2 + 1] = myconv(out, 8);
  }
  myout(myconv(output, 9));
}

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main(){
    let t = parseInt(readline());
    for(let k = 0; k < t; k++){
        let n = parseInt(readline());
        if(n === 0){
            console.log(0);
            console.log([]);
            continue;
        }
        let arr = readline().split('');
        let res = new Array(arr.length);
        let hMap = {'0': [], '1': []};
        let count = 0;
        for(let i = 0; i < arr.length; i++){
            if(arr[i] === '0'){
                if(hMap['0'].length > 0){
                    let index = hMap['0'].pop();
                    res[i] = index;
                    hMap['1'].push(index);
                }
                else{
                    hMap['1'].push(++count);
                    res[i] = count;
                }
            }else{
                if(hMap['1'].length > 0){
                    let index = hMap['1'].pop();
                    res[i] = index;
                    hMap['0'].push(index);
                }else{
                    hMap['0'].push(++count);
                    res[i] = count;
                }
            }
        }
        console.log(count);
        console.log(res);
    }
}

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main(){
    let t = parseInt(readline());
    for(let k = 0; k < t; k++){
        let n = parseInt(readline());
        let arr = readline().split('');
        let res = new Array(arr.length);
        let hMap = {'0': [], '1': []};
        let count = 0;
        for(let i = 0; i < arr.length; i++){
            if(arr[i] === '0'){
                if(hMap['0'].length > 0){
                    let index = hMap['0'].pop();
                    res[i] = index;
                    hMap['1'].push(index);
                }
                else{
                    hMap['1'].push(++count);
                    res[i] = count;
                }
            }else{
                if(hMap['1'].length > 0){
                    let index = hMap['1'].pop();
                    res[i] = index;
                    hMap['0'].push(index);
                }else{
                    hMap['0'].push(++count);
                    res[i] = count;
                }
            }
        }
        console.log(count);
        console.log(res);
    }
}


There are $$$n$$$ pieces of tangerine peel, the $$$i$$$-th of them has size $$$a_i$$$. In one step it is possible to divide one piece of size $$$x$$$ into two pieces of positive integer sizes $$$y$$$ and $$$z$$$ so that $$$y + z = x$$$.You want that for each pair of pieces, their sizes differ strictly less than twice. In other words, there should not be two pieces of size $$$x$$$ and $$$y$$$, such that $$$2x \le y$$$. What is the minimum possible number of steps needed to satisfy the condition?

The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains the integer $$$n$$$ ($$$1 \le n \le 100$$$). Then one line follows, containing $$$n$$$ integers $$$a_1 \le a_2 \le \ldots \le a_n$$$ ($$$1 \le a_i \le 10^7$$$).

For each test case, output a single line containing the minimum number of steps.

NoteIn the first test case, we initially have a piece of size $$$1$$$, so all final pieces must have size $$$1$$$. The total number of steps is: $$$0 + 1 + 2 + 3 + 4 = 10$$$.In the second test case, we have just one piece, so we don't need to do anything, and the answer is $$$0$$$ steps.In the third test case, one of the possible cut options is: $$$600,\ 900,\ (600 | 700),\ (1000 | 1000),\ (1000 | 1000 | 550)$$$. You can see this option in the picture below. The maximum piece has size $$$1000$$$, and it is less than $$$2$$$ times bigger than the minimum piece of size $$$550$$$. $$$4$$$ steps are done. We can show that it is the minimum possible number of steps.

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    let min = arr[0],
      ans = 0;
    for (let i = 1; i < n; i++) {
      if (arr[i] < 2 * min) continue;
      else {
          if(arr[i]%((2*min)-1)===0) ans+=arr[i]/((2*min)-1) - 1;
        else ans += Math.floor(arr[i] / ((2*min)-1));
      }
    }
    console.log(ans);
  }
};
solve();

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

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

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

function solve(problem) {
    problem.sort((a, b) => b - a);

    const start = problem.pop();
    const divider = start * 2 - 1;

    let actions = 0;
    while (problem.length > 0) {
        const current = problem.pop();
        actions += Math.ceil(current / divider) - 1;
    }

    return actions;
}

process.stdin.on('end', function() {
    const data = input.trim().split('\n');

    for (let i = 1; i < data.length; i += 2) {
        const problem = data[i + 1].trim().split(' ').map(Number);

        console.log(solve(problem));
    }
});

var readline = require('readline');
var inputString = [], currentLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
var rl = readline.createInterface(process.stdin);
rl.on('line', line => { inputString.push(line) });
process.stdin.on('end', () => {  main()  });

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

function main() {
    const t = +readLine();
    for(let i = 0; i < t; i++){
        const n = +readLine();
        const arr = readLine().split(' ').map(p => +p);
        let result = myFunc(n, arr);
        console.log(result);
    }
}

function myFunc(n, arr){
    arr.sort((a, b) => a - b);
    let cont = 0;
    const ref = (arr[0]*2)-1;
    for(let i = 1; i < n; i++){
        // cont += parseInt(arr[i] / ref);
        cont += Math.ceil(arr[i] / ref)-1;
    }

    return cont;
}

'use strict';

var fs = require('fs');

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

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

function solve(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const n = rn(),
        a = rns(n);
  const min = Math.min(...a) * 2 - 1;
  let res = 0;
  for (let i = 0; i < n; i++) {
    res += Math.ceil(a[i] / min) - 1;
  }
  return res;
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rn();
    return res;
  };
  const re = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rn() - 1;
    return res;
  };
  const rbs = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rb();
    return res;
  };
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  const [rn, rb, rns, re, rbs] = convertInput(r);
  try {
    let t = rn();
    let res = new Array(t);
    let limit = 100;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      } else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    } else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8')
.split(/\s+/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();

var n = +readline();
for (var i = 0; i < n; i++) {
  var k = +readline();
  var arr = readline().split(' ').map(item => +item);
  var tab = arr[0] * 2 - 1;
  var count = 0;
  for (var j = 0; j < arr.length; j++) {
    count += Math.ceil(arr[j] / tab) - 1;
  }
  print(count);
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    let min = arr[0],
      ans = 0;
   if (min === 1) {
      for (let i = 1; i < n; i++) ans += arr[i] - 1;
      console.log(ans);
      continue;
   }
    for (let i = 1; i < n; i++) {
      if (arr[i] < 2 * min) continue;
      else {
        ans += Math.floor(arr[i] / ((2*min)-1));
      }
    }
    console.log(ans);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    let min = arr[0],
      ans = 0;
    if (min === 1) {
      for (let i = 1; i < n; i++) ans += arr[i] - 1;
      console.log(ans);
      continue;
    }
    for (let i = 1; i < n; i++) {
      if (arr[i] <= 2 * min) continue;
      else {
        ans += Math.ceil(arr[i] / (2 * min)) - 1;
      }
    }
    console.log(ans);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    let min = arr[0],
      ans = 0;
    if (min === 1) {
      for (let i = 1; i < n; i++) ans += arr[i] - 1;
      console.log(ans);
      continue;
    }
    for (let i = 1; i < n; i++) {
      if (arr[i] <= 2 * min) continue;
      else {
        ans += Math.floor(arr[i] / (2 * min));
      }
    }
    console.log(ans);
  }
};
solve();

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

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

var n = +readline();
for (var i = 0; i < n; i++) {
  var k = +readline();
  var arr = readline().split(' ').map(item => +item);
  var tab = Math.min(...arr) * 2 - 1;
  var count = 0;
  for (var j = 0; j < arr.length; j++) {
    count += Math.floor(arr[j] / tab);
  }
  print(tab === 1 ? count - k : count);
}


There is an integer $$$n$$$ without zeros in its decimal representation. Alice and Bob are playing a game with this integer. Alice starts first. They play the game in turns.On her turn, Alice must swap any two digits of the integer that are on different positions. Bob on his turn always removes the last digit of the integer. The game ends when there is only one digit left.You have to find the smallest integer Alice can get in the end, if she plays optimally.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Description of the test cases follows. The first and the only line of each test case contains the integer $$$n$$$ ($$$10 \le n \le 10^9$$$) — the integer for the game. $$$n$$$ does not have zeros in its decimal representation.

For each test case output a single integer — the smallest integer Alice can get in the end of the game.

NoteIn the first test case Alice has to swap $$$1$$$ and $$$2$$$. After that Bob removes the last digit, $$$1$$$, so the answer is $$$2$$$.In the second test case Alice can swap $$$3$$$ and $$$1$$$: $$$312$$$. After that Bob deletes the last digit: $$$31$$$. Then Alice swaps $$$3$$$ and $$$1$$$: $$$13$$$ and Bob deletes $$$3$$$, so the answer is $$$1$$$.

function solve(n) {
    const arr = n.split('');
    if (arr.length === 2) {
        return n[1];
    }
    return arr.sort((a, b) => a - b)[0];
}

let text = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', t => {
    if (t === '\r\n' || t === '\n') {
        process.stdin.emit('end');
    } else {
        text += t;
    }
});
process.stdin.on('end', () => {
    const input = text.trim().replace(/\r/g, '').split('\n');
    const dataArr = input.slice(1);

    for (const item of dataArr) {
        console.log(solve(item));
    }
    process.exit();
});

const solve = rows => {
    for (let i = 0; i < rows.length; i++) {
        if (rows[i].length < 3) {
            console.log(rows[i][1]);
        } else {
            const nums = rows[i].split('');
            nums.sort((a, b) => a - b);
            console.log(nums[0]);
        }
    }
}
const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

let num = -1;
const rows = [];
rl.on('line', line => {
    if (num < 0) {
        num = parseInt(line.trim());
    } else {
        rows.push(line.trim());
        if (rows.length === num) {
            dealInput();
        }
    }
});
const dealInput = () => {
    solve(rows);
    rl.close();
};

rl.on('close', () => {
    process.exit(0);
});

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

function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
var T = readline();
for(var qe=1;qe<=T;qe++) {
  var n = readline()//.split(' ').map((x) => parseInt(x));
  //n = parseInt(n);
  //var a = readline().split(' ').map((x) => parseInt(x));
  var as = ''+n;
  var len = as.length;
  var a = as.split('');
  var t = [...a]
  var ans = 0;
  t.sort();
  if(len > 2) ans = t[0]
  else if(t[0] != a[0]) ans = t[0]
  else ans = t[1];

  console.log(ans);
  //fs.appendFileSync('output.txt', ans+'\r\n');

}
//

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

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

    for (let test = 0; test < N; test++) {
        let n = readline();
        let ints = n.split('').map(Number);
        if (ints.length === 1) {
            output(ints[0]);
            continue;
        } else if (ints.length === 2) {
            output(ints[1]);
            continue;
        }
        ints.sort();
        output(ints[0]);
    }
}

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

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

let lines = 0;

rl.on("line", function (line) {
  if (lines !== 0) {
    let input = line.split("").map(Number);
    if (input.length == 2) {
      console.log(input[1]);
    } else {
      console.log(Math.min(...input));
    }
  }

  lines++;
});

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

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

function div(val, by){
    return (val - val % by) / by;
}

const calc = ()=>{
    /* read */
    let s = readline().split('').map(a=>+a);

    if (s.length === 2) {
        return s[1];
    }
    let min = s[0];

    for (let i = 1; i < s.length; i++) {
        min = Math.min(min, s[i]);
    }

    return min;

};

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

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) {
  const a = n.toString(10).split('').map(Number);
  if (a.length === 2) return a[1];
  return a.sort((a, b) => a - b)[0];
}

async function main(read) {
  let t = Number(await read());
  let res = [];
  while (t--) {
    const n = Number(await read());
    res.push(solve(n));
  }
  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);
}();

'use strict';
// HEADER:
const print = function(arg){
  let str = arg;
  if (arguments.length>1)
    str = Array.prototype.slice.call(arguments).join(' ');
  process.stdout.write(str+'\n');
};
let IS_MULTITEST, testN, tests;
const pcalc = (testN, toPrint)=>{
  let res = calc(testN);
  if (Array.isArray(res)){
    toPrint.push(res.join(' '));
  } else if (Number.isFinite(res) || typeof res=='string'){
    toPrint.push(res+'');
  }
  if (process.env.DEBUG && toPrint.length){
    let ans = toPrint.pop();
    print(ans);
    let expected = tests[testN-1];
    if (expected){
      if (expected==ans)
        console.log('\x1b[32m%s\x1b[0m', 'correct');
      else {
        console.log('\x1b[31m%s\x1b[0m', 'wrong, expected:', expected);
      }
    }
  }
};

const main = ()=>{
  let toPrint = [];
  L('\nSolving:');
  if (IS_MULTITEST){
    let T = +readline()
    for (testN=1; testN<=T; testN++)
      pcalc(testN, toPrint);
  } else {
    pcalc(1, toPrint);
  }
  if (toPrint.length){
    print(toPrint.join('\n'));
  }
};

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(`\nTest #${testN}`, obj);

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

tests = [
``, // Test #1
``, // Test #2
``, // Test #3
``, // Test #4
``, // Test #5
];

// SOLUTION:
IS_MULTITEST = true;

const calc = (testN)=>{
  // READING:
  let s = readline();
  LT({s});
  // PROCESSING:
  let ans = 0;
  if (s.length==2)
    return s[1]
  let min = s[0];
  for (let i=0; i<s.length; i++)
    min = Math.min(min, +s[i])

  return min;
};

T = readline()
while (T--) {
   x = readline().split('').map(x => +x)
   min = Math.min(...x)
   if(x.indexOf(min) === 0 && x.length === 2){
      x.shift()
      min = Math.min(...x)
   }
   print(min)
}

const solve = num => {
    num.trim();
    if (num.length === 2) {
        console.log(Number(num[1]));
    } else {
        const arr = num.split('').map(item => parseInt(item, 10));
        arr.sort((a, b) => a - b);
        console.log(arr[0]);
    }
}

let line = '';
process.stdin.on('data', c => line += c);
process.stdin.on('end', () => {
    const input = line.trim().split('\n');
    const n = parseInt(input[0]);
    for (let i = 1; i <= n; i++) {
        const arr = input[i];
        solve(arr);
    }
});

const solve = arr => {
    if (arr.length === 2) {
        console.log(arr[1]);
    } else {
        arr.sort((a, b) => a - b);
        console.log(arr[0]);
    }
}

let line = '';
process.stdin.on('data', c => line += c);
process.stdin.on('end', () => {
    const input = line.trim().split('\n');
    const n = parseInt(input[0]);
    for (let i = 1; i <= n; i++) {
        const arr = input[i].split('').map(item => parseInt(item));
        solve(arr);
    }
});

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

function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
var T = readline();
for(var qe=1;qe<=T;qe++) {
  var n = readline()//.split(' ').map((x) => parseInt(x));
  //n = parseInt(n);
  //var a = readline().split(' ').map((x) => parseInt(x));
  var as = ''+n;
  var len = as.length;
  var a = as.split('');
  var ans = 0;
  a.sort();
  if(len > 2) ans = a[0]
  else ans = a[1]

  console.log(ans);
  //fs.appendFileSync('output.txt', ans+'\r\n');

}
//