var test = readline().split(' ')[0];
var ara = [];
var obj = {};
while(test>0){
	var x = readline();
	var p = eval(x);
	p = Math.round(p*10000000000)/10000000000;
	if(obj.hasOwnProperty(p+"")){
		obj[p]+=1;
	}
	else{
		obj[p+""]= 1;
	}
	ara.push(p);
	test--;
}
var ans = "";
for(var i = 0 ; i<ara.length;i++){
	ans+= obj[ara[i]] +" ";
}
print(ans);

(()=>{"use strict";var t={675:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),Array.numbersMatrix=(t,e,r)=>{let n=[];null==t&&(e=t),null==r&&(r=0);for(let i=0;i<t;++i){let t=[];for(let n=0;n<e;++n)t.push(r);n.push(t)}return n},Array.prototype.sortAsc=function(){return this.sort(((t,e)=>t-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.max(t,this[e]);return t},Array.prototype.min=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.min(t,this[e]);return t},Array.prototype.sum=function(){let t=0;for(let e=0;e<this.length;++e)t+=this[e];return t},Array.prototype.modSum=function(t){let e=0;for(let r=0;r<this.length;++r)e+=this[r],e%=t;return e},Array.prototype.avg=function(){return this.sum()/this.length},Array.prototype.groupBy=function(t){let e=new Map;for(let r=0;r<this.length;++r){const n=t(this[r]);e.has(n)?e.get(n).push(this[r]):e.set(n,[this[r]])}return e},Array.prototype.deepCopy=function(){let t=[];if(0==this.length)return t;let e=!1;Array.isArray(this[0])&&(e=!0);for(let r=0;r<this.length;++r)e?t.push(this[r].deepCopy()):t.push(this[r]);return t},Array.prototype.transpose=function(){let t=[];if(0==this.length)return[[]];for(let e=0;e<this[0].length;++e){let r=[];for(let t=0;t<this.length;++t)r.push(this[t][e]);t.push(r)}return t},Array.prototype.toString=function(){if(0==this.length)return"";if(!Array.isArray(this[0]))return this.join(" ");let t="";for(let e=0;e<this.length;++e)t+=this[e].join(" "),e!=this.length-1&&(t+="\n");return t}},312:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=n(r(747));let o="",s=[],u=0,l="";const p="local"===process.argv[2],a=t=>{if(p){if(s=i.default.readFileSync("input.txt").toString().trim().split("\n").map((t=>t.trim())),t(),i.default.writeFileSync("output.txt",l),console.log(l),i.default.readFileSync("expected.txt").toString().trim()==l.trim()){const{exec:t}=r(129);t("osascript -e 'display notification \"✅ AC!!\"'")}}else process.stdin.resume(),process.stdin.setEncoding("utf-8"),process.stdin.on("data",(t=>{o+=t})),process.stdin.on("end",(e=>{s=o.trim().split("\n").map((t=>t.trim())),t(),console.log(l)}))};function f(){return s[u++]}function h(){return f().split(" ").map((t=>parseFloat(t)))}function c(){return f().split("")}e.default={runMain:a,runEachTest:t=>{a((()=>{let[e]=h();for(;e>0;)t(),e--}))},readline:f,nextNumbers:h,nextBigNumbers:function(){return f().split(" ").map((t=>BigInt(t)))},nextNumbersMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(h());return e},nextCharacters:c,nextCharacterMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(c());return e},nextIntervalArray:function(t){let e=[];for(let r=0;r<t;++r){const[t,r]=h();e.push({a:t,b:r})}return e},put:function(t){l+=t},puts:function(t){l+=t+"\n"},debug:function(t){p&&console.log(t)}}},965:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(675);const i=n(r(312)),o=r(719);i.default.runMain((function(){let[t]=i.default.nextNumbers(),e=t=>{t=t.replace("(","").replace(")","").replace("/","+");let[e,r,n]=t.split("+").map((t=>parseInt(t))),i=o.gcd(e+r,n);return`${(e+r)/i}/${n/i}`},r={},n=[];for(let o=0;o<t;++o){let t=e(i.default.readline());r[t]=r[t]+1||1,n.push(t)}i.default.put(n.map((t=>r[t])).join(" "))}))},719:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isPrime=e.gcd=void 0,e.gcd=function t(e,r){return 0==r?e:t(r,e%r)},e.isPrime=function(t){return!0}},129:t=>{t.exports=require("child_process")},747:t=>{t.exports=require("fs")}},e={};!function r(n){if(e[n])return e[n].exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(965)})();

// Solution written in typescript and compiled via webpack. Original source code below
// Happy Hacking 😜

// numberTheory.ts

// function gcd(a: number, b: number) {
//   if (b == 0) {
//     return a
//   }
//
//   return gcd(b, a % b)
// }
//
// function isPrime(x: number) {
//   return true
// }
//
// export { gcd, isPrime }

// import './array'
//
// import io from './io'
// import { gcd } from './numberTheory'
//
// function main() {
//   let [n] = io.nextNumbers()
//
//   let parse = (s: string) => {
//     s = s.replace("(", "").replace(")", "").replace("/", "+")
//
//     let [a, b, c] = s.split("+").map((x) => parseInt(x))
//
//     let g = gcd(a + b, c)
//
//     return `${(a + b) / g}/${c / g}`
//   }
//
//   let cnt: any = {}
//
//   let r: string[] = []
//
//   for (let i = 0; i < n; ++i) {
//     let s = io.readline()
//
//     let x = parse(s)
//
//     cnt[x] = cnt[x] + 1 || 1
//
//     r.push(x)
//   }
//
//   io.put(r.map((x) => cnt[x]).join(" "))
// }
//
// // io.runEachTest(main)
// io.runMain(main)

(()=>{"use strict";var t={675:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),Array.numbersMatrix=(t,e,r)=>{let n=[];null==t&&(e=t),null==r&&(r=0);for(let i=0;i<t;++i){let t=[];for(let n=0;n<e;++n)t.push(r);n.push(t)}return n},Array.prototype.sortAsc=function(){return this.sort(((t,e)=>t-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.max(t,this[e]);return t},Array.prototype.min=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.min(t,this[e]);return t},Array.prototype.sum=function(){let t=0;for(let e=0;e<this.length;++e)t+=this[e];return t},Array.prototype.modSum=function(t){let e=0;for(let r=0;r<this.length;++r)e+=this[r],e%=t;return e},Array.prototype.avg=function(){return this.sum()/this.length},Array.prototype.groupBy=function(t){let e=new Map;for(let r=0;r<this.length;++r){const n=t(this[r]);e.has(n)?e.get(n).push(this[r]):e.set(n,[this[r]])}return e},Array.prototype.deepCopy=function(){let t=[];if(0==this.length)return t;let e=!1;Array.isArray(this[0])&&(e=!0);for(let r=0;r<this.length;++r)e?t.push(this[r].deepCopy()):t.push(this[r]);return t},Array.prototype.transpose=function(){let t=[];if(0==this.length)return[[]];for(let e=0;e<this[0].length;++e){let r=[];for(let t=0;t<this.length;++t)r.push(this[t][e]);t.push(r)}return t},Array.prototype.toString=function(){if(0==this.length)return"";if(!Array.isArray(this[0]))return this.join(" ");let t="";for(let e=0;e<this.length;++e)t+=this[e].join(" "),e!=this.length-1&&(t+="\n");return t}},312:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=n(r(747));let o="",s=[],u=0,l="";const p="local"===process.argv[2],a=t=>{if(p){if(s=i.default.readFileSync("input.txt").toString().trim().split("\n").map((t=>t.trim())),t(),i.default.writeFileSync("output.txt",l),console.log(l),i.default.readFileSync("expected.txt").toString().trim()==l.trim()){const{exec:t}=r(129);t("osascript -e 'display notification \"✅ AC!!\"'")}}else process.stdin.resume(),process.stdin.setEncoding("utf-8"),process.stdin.on("data",(t=>{o+=t})),process.stdin.on("end",(e=>{s=o.trim().split("\n").map((t=>t.trim())),t(),console.log(l)}))};function h(){return s[u++]}function f(){return h().split(" ").map((t=>parseFloat(t)))}function c(){return h().split("")}e.default={runMain:a,runEachTest:t=>{a((()=>{let[e]=f();for(;e>0;)t(),e--}))},readline:h,nextNumbers:f,nextBigNumbers:function(){return h().split(" ").map((t=>BigInt(t)))},nextNumbersMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(f());return e},nextCharacters:c,nextCharacterMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(c());return e},nextIntervalArray:function(t){let e=[];for(let r=0;r<t;++r){const[t,r]=f();e.push({a:t,b:r})}return e},put:function(t){l+=t},puts:function(t){l+=t+"\n"},debug:function(t){p&&console.log(t)}}},965:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(675);const i=n(r(312));i.default.runMain((function(){let[t]=i.default.nextNumbers(),e=t=>{t=t.replace("(","").replace(")","").replace("/","+");let[e,r,n]=t.split("+").map((t=>parseInt(t)));return Math.floor((e+r)/n)},r={},n=[];for(let o=0;o<t;++o){let t=e(i.default.readline());r[t]=r[t]+1||1,n.push(t)}i.default.put(n.map((t=>r[t])).join(" "))}))},129:t=>{t.exports=require("child_process")},747:t=>{t.exports=require("fs")}},e={};!function r(n){if(e[n])return e[n].exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(965)})();

// Solution written in typescript and compiled via webpack. Original source code below
// Happy Hacking 😜

// import './array'
//
// import io from './io'
//
// function main() {
//   let [n] = io.nextNumbers()
//
//   let parse = (s: string) => {
//     s = s.replace("(", "").replace(")", "").replace("/", "+")
//
//     let [a, b, c] = s.split("+").map((x) => parseInt(x))
//
//     return Math.floor((a + b) / c)
//   }
//
//   let cnt: any = {}
//
//   let r: number[] = []
//
//   for (let i = 0; i < n; ++i) {
//     let s = io.readline()
//
//     let x = parse(s)
//
//     cnt[x] = cnt[x] + 1 || 1
//
//     r.push(x)
//   }
//
//   io.put(r.map((x) => cnt[x]).join(" "))
// }
//
// // io.runEachTest(main)
// io.runMain(main)


function calc(n, r) {
  if (n === 6) {
    return r;
  } else {
    sinAlpha = Math.sin(Math.PI / n);
    return r * sinAlpha / (1 - sinAlpha);
  }
}

var nr = readline().split(" ");
var n = parseInt(nr[0]);
var r = parseInt(nr[1]);

print(calc(n, r));

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

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}

function main() {
  const [n, R] = readLine()
    .split(" ")
    .map((n) => parseInt(n));

  const theta = Math.PI / n;
  const sinTheta = parseFloat(Math.sin(theta));
  const r = (R * sinTheta) / (1 - sinTheta);

  console.log(r.toFixed(7));
}


function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn, init) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b, fn);
  if (b < a) return [];
  let arr = Array(b - a + 1).fill(0);
  if (init) init(arr);
  for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
let MOD = 998244353
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = a / b | 0, a -= t * b, u -= t * v, t = a, a = b, b = t, t = u, u = v);
  return (u + MOD) % MOD;
}
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[998244353 % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, min = Math.min, max = Math.max, abs = Math.abs;
  let t = $()
  while (t--) {
    let [n, k] = $(2)
    let a = $(n).uniq()
    // log(a)
    if (k == 1) {
      if (a.length == 1) log(1);
      else log(-1)
    } else {
      log(For(1, 100, i => Math.ceil((a.length - 1) / i + 1) <= k ? i : null))
    }
  }
}

function solv() {
    var ip = readline().split(' ').map(x => parseInt(x));
    var x = ip[0]
    var y = ip[1]
    var s = readline().split(' ').map(x => parseInt(x))

    var v = {}
    for (var n = 0; n < x; n++)v[s[n]] = 1
    s = []
    for (n in v) s.push(n);
    if (s.length > 1 && y == 1) {
        print(-1);
        return;
    }
    var res = 1;
    var cur = 0;
    v = {};
    for (var n = 0; n < s.length; n++) {
        v[s[n]] = 1;
        if (Object.keys(v).length == y && n < s.length - 1) {
            res++;
            v = {};
            v[s[n]] = 1;
        }
    }
    print(res);
}
var t = parseInt(readline());
while (t--)
    solv()

#!/usr/bin/env node
'use strict';

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

const buf = [];
const prom = [];
let maxBuf = 0;
let maxProm = 0;
rl.on('line', (line) => {
  if (prom.length > 0) {
    maxProm = Math.max(maxProm, prom.length);
    const [resolve, reject] = prom.shift();
    resolve(line);
  } else {
    rl.pause();
    buf.push(line);
    maxBuf = Math.max(maxBuf, buf.length);
  }
});

rl.on('close', () => {
  // console.error({maxProm, maxBuf});
});

async function getLine() {
  return new Promise((resolve, reject) => {
    if (buf.length > 0) {
      const line = buf.shift();
      resolve(line);
    } else {
      prom.push([resolve, reject]);
      rl.resume();
    }
  });
}

/**
 *
 * @param {Number []} a
 * @param {Number} k
 * @returns {Number []}
 */
function solve(a, k) {
  if (k < 1) {
    return -1;
  }
  const n = a.length;
  if (n < 1) {
    return -1;
  }
  const kinds = new Set();
  for (const ai of a) {
    kinds.add(ai);
  }
  const m = kinds.size;
  if (k === 1) {
    return (m !== 1) ? -1 : 1;
  }

  return (m === 1) ? 1 : Math.ceil((m - 1) / (k - 1));
}

async function main() {
  const t = Number(await getLine());
  for (let i = 0; i < t; i++) {
    const [n, k] = (await getLine()).split(' ').map(Number);
    const a = (await getLine()).split(' ').map(Number);
    const res = solve(a, k);
    console.log(res);
  }
}

if (require.main === module) {
  main();
}

function solv() {
    var ip = readline().split(' ').map(x => parseInt(x));
    var x = ip[0]
    var y = ip[1]
    var s = readline().split(' ').map(x => parseInt(x))

    var v = {}
    for (var n = 0; n < x; n++)v[s[n]] = 1
    s = []
    for (n in v) s.push(n);
    if (s.length > 1 && y == 1) {
        print(-1);
        return;
    }
    var res = 1;
    var cur = 0;
    v = {};
    for (n in s) {
        v[n] = 1;
        if (Object.keys(v).length > y) {
            res++;
            v = {};
        }
    }
    print(res);
}
var t = parseInt(readline());
while (t--)
    solv()

function solv() {
    var ip = readline().split(' ').map(x => parseInt(x));
    var x = ip[0]
    var y = ip[1]
    var s = readline().split(' ').map(x => parseInt(x))

    var v = {}
    for (var n = 0; n < x; n++)v[s[n]] = 1
    s = []
    for (n in v) s.push(n);
    if (s.length > 1 && y == 1) {
        print(-1);
        return;
    }
    var res = 1;
    var cur = 0;
    v = {};
    for (n in s) {
        v[n] = 1;
        if (Object.keys(v).length > y) {
            res++;
            v = {};
            v[n] = 1;
        }
    }
    print(res);
}
var t = parseInt(readline());
while (t--)
    solv()


const readline = require('readline')

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

class Queue {
    constructor() {
        this.map = {}
        this.first = 0
        this.last = 0
    }
    push(...args) {
        for (let i = 0; i < args.length; i++) {
            this.map[this.last++] = args[i]
        }
    }
    pop() {
        const r = this.map[this.last]
        delete this.map[this.last]
        this.last--
        return r
    }
    shift() {
        const r = this.map[this.first]
        delete this.map[this.first]
        this.first++
        return r
    }
    get length() {
        if (this.first >= this.last) return 0
        return this.last - this.first
    }
    get(x) {
        return this.map[x]
    }
    getLast() {
        return this.map[this.last - 1]
    }
}

function solve(n, edges) {
    const adj = {}
    const es = Array(n + 1)
    edges.forEach(([p, va, vb], i) => {
        let a = i + 2
        let b = p
        adj[a] = adj[a] || []
        adj[b] = adj[b] || []
        adj[a].push(b)
        adj[b].push(a)
        es[a] = [va, vb]
    })
    return dfs(adj, 1, n, es).join(' ')
}
function dfs(adj, r, n, es) {
    // const stack = [[r, 0, -1]]
    const stack = new Queue()
    stack.push([r, 0, -1])
    const rs = Array(n).fill(0)
    // const sa = new Queue()
    // sa.push(0)
    let sa = 0
    const sb = new Queue()
    sb.push(0)
    while (stack.length) {
        const [u, i, p] = stack.getLast()
        // visited[u] = 1

        const nb = adj[u] || []
        if (!i) {
            // first visited
            if (p >= 0) {
                sa += es[u][0]
                // sb += es[u][1]
                sb.push(sb.getLast() + es[u][1])
                rs[u] = binarySearch(0, sb.length - 1, x => {
                    return sb.get(x) <= sa
                })
            }
        }
        if (i < nb.length) {
            stack.getLast()[1]++
            const v = nb[i]
            // if (!visited[v]) { // has circle
            if (v !== p) {
                stack.push([v, 0, u])
            }
        } else {
            // last visited
            stack.pop()
            if (p >= 0) {
                sa -= es[u][0]
                // sb -= es[u][1]
                sb.pop()
            }
        }
    }
    rs.shift()
    rs.shift()
    return rs
}
function binarySearch(l, r, fn) {
    while (l <= r) {
        const m = Math.floor((l + r) / 2)
        if (fn(m)) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return r
}

'use strict';

function solve(n, a) {
  const h = new Array(n).fill(-1),
        te = [],
        ne = [],
        d = new Array(n).fill(0),
        b = [],
        c = [];
  const add = (i, j, x, y) => {
    b.push(x), c.push(y), te.push(j), ne.push(h[i]), h[i] = ne.length - 1, d[j]++;
  };
  for (let [i, [p, x, y]] of a.entries()) {
    add(p - 1, i + 1, x, y);
  }
  const res = [],
        pre = [0];
  const dfs = RTI((u, w, p = -1, sum = 0) => {
    if (p !== -1) {
      pre.push(pre[pre.length - 1] + w);
      let l = 0,
          r = pre.length - 1;
      while (l < r) {
        const m = l + r + 1 >> 1;
        if (pre[m] <= sum) {
          l = m;
        } else {
          r = m - 1;
        }
      }
      res[u - 1] = l;
    }
    const inside = () => {
      let res = [];
      for (let i = h[u]; ~i; i = ne[i]) {
        const v = te[i];
        if (p === v) continue;
        sum += b[i];
        res.push([v, c[i], u, sum]);
        sum -= b[i];
      }
      return res;
    };
    const after = (args, childResult) => {
      pre.pop();
    };
    return [inside, after];
  });
  dfs(0);
  return res.join(' ');
}
function RTI(fn) {
  let res;
  const createNode = args => {
    return {
      args,
      result: [],
      curIndex: 0
    };
  };
  const dfs = (...args) => {
    const root = createNode([args]);
    root.cb = ([args], [result]) => res = result;
    const callStack = [root];
    while (callStack.length) {
      let curCall = callStack[callStack.length - 1];
      while (curCall && curCall.args.length === curCall.curIndex) {
        var _curCall$cb, _curCall;
        const res = (_curCall$cb = (_curCall = curCall).cb) === null || _curCall$cb === void 0 ? void 0 : _curCall$cb.call(_curCall, curCall.args, curCall.result);
        callStack.pop();
        curCall = callStack[callStack.length - 1];
        if (curCall) curCall.result[curCall.curIndex++] = res;
      }
      if (!curCall) break;
      const {
        args,
        curIndex
      } = curCall;
      {
        const res = fn(...args[curIndex]);
        const [inside, after] = res;
        let nextCall = inside();
        const node = createNode(nextCall);
        node.cb = after;
        callStack.push(node);
      }
    }
    return res;
  };
  return dfs;
}

async function main(r) {
  const rn = async () => Number(await r());
  const rns = async () => {
    return (await r()).split(' ').filter(s => s !== '').map(Number);
  };
  try {
    let t = Number(await r());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      const n = await rn();
      const a = [];
      let tmp = n - 1;
      while (tmp--) {
        a.push(await rns());
      }
      res[i] = solve(n, a);
    }
    return res.join('\n');
  } catch (error) {
    console.log(error);
  }
}

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


'use strict'

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

let res = []
let c = 1
for (let i = 0; i < N; i++) {
  if (lll[i] == c) {c++; res.push(i + 2001)}
}

print(res.length)
if (res.length) print(res.join(' '))

const readline = require('readline');

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

var n, indicator=0;
rl.on('line', (input) => {
    if(indicator==0){
        n=parseInt(input);
        indicator++;
    }
    else{
        let cont=input.split(" ").map(item=>parseInt(item));
        let  ans=[];
        for(let i=0,year=2001,temp=1;i<cont.length;i++,year++){
            if(cont[i]==temp){
                ans.push(year);
                temp++;

            }

        }
      console.log(ans.length);
      /*
      for(let i=0; i<ans.length;i++){
          rl.write(ans[i]+" ");
      }*/
      /*
      ans.forEach(item=>{
          rl.write(item+" ");
      });
      */
     console.log(ans.join(" "));
      rl.close();

    }
  });

var n = parseInt(readline());
var input = readline().split(' ').map(function (a) {return parseInt(a)});
var curr_value = 1;
var curr_year = 2001;
var years = [];
var num = 0;

for (var i = 0; i < n; i++) {
	if (input[i] == curr_value) {
		years.push(curr_year);
		num++;
		curr_value++;
	}
	curr_year++;
}

if (num === 0) {
	print(0);
} else {
	print(num);
	print(years.join(' '));
}

const readline = require('readline');

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

var n, indicator=0;
rl.on('line', (input) => {
    if(indicator==0){
        n=parseInt(input);
        indicator++;
    }
    else{
        let cont=input.split(" ").map(item=>parseInt(item));
        let  ans=[];
        for(let i=0,year=2001,temp=1;i<cont.length;i++,year++){
            if(cont[i]==temp){
                ans.push(year);
                temp++;

            }

        }
      console.log(ans.length);

      ans.forEach(item=>{
          rl.write(item+" ");
      });
      rl.close();

    }
  });

const readline = require('readline');

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

var n, indicator=0;
rl.on('line', (input) => {
    if(indicator==0){
        n=parseInt(input);
        indicator++;
    }
    else{
        let cont=input.split(" ").map(item=>parseInt(item));
        let  ans=[];
        for(let i=0,year=2001,temp=1;i<cont.length;i++,year++){
            if(cont[i]==temp){
                ans.push(year);
                temp++;

            }

        }
      console.log(ans.length);
      /*
      for(let i=0; i<ans.length;i++){
          rl.write(ans[i]+" ");
      }*/
      ans.forEach(item=>{
          rl.write(item+" ");
      });
      rl.close();

    }
  });


process.stdin.setEncoding('utf-8')
const readline = require('readline')

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

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        inputArr = inputArr.map(i => i.split(' ').map(j => BigInt(j)))
        main()
        process.exit(0)
    }
})

function sumS(n, count) {
    let res = 1n
    for (let j = 0n; j < count; ++j) res = (res * n) % 1000000007n
    return res
}

function solve([n, k]) {
    let dbl, sum = 0n, counter = 0n
    while ((2n ** counter) <= k) {
        dbl = (k >> counter) & 1n
        if (dbl) sum = (sum + sumS(n, counter)) % 1000000007n
        counter++
    }
    console.log(sum.toString())
}

function main() {
    for (let i = 0; i < inputArr.length; i++) solve(inputArr[i])
}

let mod = BigInt(10e8+7);
const solve = (n,k)=>{
     let n1 = k,cnt = 1n,res = 0n;
     while(n1){
          if(n1&1n){
               res = (res + cnt)%mod;
          }
          n1 = n1>>1n;
          cnt = (cnt*n)%mod;
     }
     console.log(res+"");
}
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,k] = readline().trim().split(" ").map(cur=>BigInt(cur));
       solve(n,k);
  }
}
main();

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++]
    for (let i = 0; i < t; i++) {
        const [n, k] = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, k))
    }
// })()
})

function solve(n, k) {
    const str = k.toString(2)
    let base = 1
    let sum = 0
    for (let i = str.length - 1; i >= 0; i--) {
        if (str[i] === '1') {
            sum = add(sum, base)
        }
        base = mul(base, n)
    }
    return sum
}
function add(a, b) {
    return (a + b) % (1e9 + 7)
}
function mul(a, b) {
    let r = 0
    let base = a
    while (b) {
        if (b & 1) {
            r = add(r, base)
        }
        b >>= 1
        base = add(base, base)
    }
    return r
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

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

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        inputArr = inputArr.map(i => i.split(' ').map(j => +j))
        main()
        process.exit(0)
    }
})

function sumS(n, count) {
    let res = 1
    for (let j = 0; j < count; ++j) res = (res * n) % 1000000007
    return res
}

function solve([n, k]) {
    let dbl, sum = 0, counter = 0
    while ((2 ** counter) <= k) {
        dbl = (k >> counter) & 1
        if (dbl) sum = (sum + sumS(n, counter)) % 1000000007
        counter++
    }
    console.log(sum)
}

function main() {
    for (let i = 0; i < inputArr.length; i++) solve(inputArr[i])
}


'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) {
  if (n % 2n !== 0n || n < 4n) return '-1';
  let min = 0n,
      max = 0n;
  for (let i = 0n; i < n; i++) {
    if ((n - 4n * i) % 6n === 0n) {
      min = i + (n - 4n * i) / 6n;
      break;
    }
  }
  for (let i = 0n; i < n; i++) {
    if ((n - 6n * i) % 4n === 0n) {
      max = i + (n - 6n * i) / 4n;
      break;
    }
  }
  return `${min.toString()} ${max.toString()}`;
}

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

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

let ls = [];

function solve() {
    let l = 0;
    let t = parseInt(ls[l++]);
    for (; t > 0; t--){
        const n = BigInt(ls[l++]);
        if (n % 2n == 1 || n < 4n){
            console.log(-1);
            continue;
        }

        let x = n % 6n == 0 ? n / 6n : n / 6n + 1n;
        let y = n / 4n;
        console.log(`${x} ${y}`);
    }
}

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

'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 = [
`1 1`, // Test #1
`-1`, // Test #2
`4 6`, // Test #3
`166374058999707392 249561088499561088`, // Test #4
``, // Test #5
];

// SOLUTION:
IS_MULTITEST = true;

const calc = (testN)=>{
  // READING:
  let n = readline();
  n = BigInt(n);
  LT({n});
  // PROCESSING:
  if (n % 2n != 0n){
    return -1;
  }
  n = n / 2n;
  let min, max;
  for (let x = 0n; x<=5n; x++){
    let m = n - x*2n;
    if (m>=0 && m%3n==0){
      min = x + m/3n;
      break;
    }
  }
  if (!min)
    return -1;
  for (let y = 0n; y<=5n; y++){
    let m = n - y*3n;
    if (m>=0 && m%2n==0){
      max = y + m/2n;
      break;
    }
  }
  if (!max)
    return -1;
  return [min.toString(), max.toString()]
};

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {
var testCase = parseInt(readline());

function division(n, divisor) {
    var remainder;
    var dividend = n[0];
    var quotient = [];

    for (let i = 0; i < n.length; i++) {
        if (dividend < divisor) {
            quotient.push(Math.floor(dividend / divisor));
            remainder = dividend;
            dividend = (remainder * 10) + n[i + 1];
        } else {
            quotient.push(Math.floor(dividend / divisor));
            remainder = dividend % divisor;
            dividend = (remainder * 10) + n[i + 1];
        }
    }

    if (quotient[0] === 0) {
        quotient.shift();
    }
    if (divisor === 6 && remainder > 0) {
        if (quotient.length < 2) {
            return Number(quotient.join("")) + 1;
        }
        var carry = 1;
        var total =[];
        var sum;
        for (let j = quotient.length -1 ; j >= 0; j--) {
            sum = quotient[j] + carry;
            if (sum > 9 && j!==0) {
                total.unshift(0);
            } else {
                total.unshift(sum);
                carry = 0;
            }
        }
        return total.join("");
    }
    return quotient.join("");
}

for (let i = 0; i < testCase; i++) {
    var n = readline().trim().split('').map(Number);
    var result;
    var sum = 0;
    for (let i = 0; i < n.length; i++) {
        sum += n[i];
    }
    var divisiblebyfour = n.length < 2 ? n[n.length - 1] : ((n[n.length - 2] * 10) + n[n.length - 1]);
    if (n[n.length - 1] % 2 !== 0) {
        console.log(-1);
    } else if (n.length < 2 && n[n.length - 1] < 4) {
        console.log(-1);
    } else {
        console.log(division(n, 6), division(n, 4));
    }
}
}

const solve = (str)=>{
     let n = BigInt(str);
     let min = 6n;
     let max = 4n;
     if((n%2n===1n)||(n<3n)) return -1;
     let r1 = n%min,r2 = n%max;
     r1 = r1>0n ? (n/min)+1n : n/min;
     r2 = n/max;
     return `${r1} ${r2}`;
}
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();
       console.log(solve(n));
  }
}
main();

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 = BigInt(lines[l++])
        output[i] = solve(n)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n) {
    if (n < 4n) return -1
    if (n & 1n) return -1
    const a = n / 4n
    const b = ceil(n, 6n)
    return b + ' ' + a
}
function ceil(a, b) {
    const r = a % b
    const f = a / b
    return r ? f + 1n : f
}

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

let lines = 0;
const maxBuses = (n) => {
  switch (n % 4n) {
    case 0n:
      return n / 4n;
    case 1n:
      return -1;
    case 2n:
      return n > 4n ? (n - 4n) / 4n + 1n : -1;
    case 3n:
      return -1;
  }
};
const minBuses = (n) => {
  switch (n % 6n) {
    case 0n:
      return n / 6n;
    case 1n:
      return -1;
    case 2n:
      return n > 6n ? (n - 6n) / 6n + 2n : -1;
    case 3n:
      return -1;
    case 4n:
      return n > 6n ? n / 6n + 1n : -1;
    case 5n:
      return -1;
  }
};

rl.on("line", function (line) {
  if (lines !== 0) {
    const input = BigInt(line);
    const min = minBuses(input);
    const max = maxBuses(input);
    if (min === -1 && max === -1) {
      return console.log("-1");
    } else if (min === -1 || max === -1) {
      const [common] = [min, max]
        .filter((x) => x !== -1)
        .map((x) => x.toString());
      return console.log(common, common);
    }
    console.log(min.toString(), max.toString());
  }
  lines++;
});

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {
var testCase = parseInt(readline());

function division(n, divisor) {
    var remainder;
    var dividend = n[0];
    var quotient = [];

    for (let i = 0; i < n.length; i++) {
        if (dividend < divisor) {
            quotient.push(Math.floor(dividend / divisor));
            remainder = dividend;
            dividend = (remainder * 10) + n[i + 1];
        } else {
            quotient.push(Math.floor(dividend / divisor));
            remainder = dividend % divisor;
            dividend = (remainder * 10) + n[i + 1];
        }
    }

    if (quotient[0] === 0) {
        quotient.shift();
    }
    if (divisor === 6 && remainder > 0) {
        if (quotient.length < 2) {
            return 1;
        }
        var carry = 1;
        var total =[];
        var sum;
        for (let j = quotient.length -1 ; j >= 0; j--) {
            sum = quotient[j] + carry;
            if (sum > 9 && j!==0) {
                total.unshift(0);
            } else {
                total.unshift(sum);
                carry = 0;
            }
        }
        return total.join("");
    }
    return quotient.join("");
}

for (let i = 0; i < testCase; i++) {
    var n = readline().trim().split('').map(Number);
    var result;
    var sum = 0;
    for (let i = 0; i < n.length; i++) {
        sum += n[i];
    }
    var divisiblebyfour = n.length < 2 ? n[n.length - 1] : ((n[n.length - 2] * 10) + n[n.length - 1]);
    if (n[n.length - 1] % 2 !== 0) {
        console.log(-1);
    } else if (n.length < 2 && n[n.length - 1] < 4) {
        console.log(-1);
    } else {
        console.log(division(n, 6), division(n, 4));
    }
}
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {
var testCase = parseInt(readline());

function division(n, divisor) {
    var remainder;
    var dividend = n[0];
    var quotient = [];

    for (let i = 0; i < n.length; i++) {
        if (dividend < divisor) {
            quotient.push(Math.floor(dividend / divisor));
            remainder = dividend;
            dividend = (remainder * 10) + n[i + 1];
        } else {
            quotient.push(Math.floor(dividend / divisor));
            remainder = dividend % divisor;
            dividend = (remainder * 10) + n[i + 1];
        }
    }

    if (quotient[0] === 0) {
        quotient.shift();
    }
    if (divisor === 6 && remainder > 0) {
        var carry = 1;
        var total =[];
        var sum;
        for (let j = quotient.length -1 ; j >= 0; j--) {
            sum = quotient[j] + carry;
            if (sum > 9 && j!==0) {
                total.unshift(0);
            } else {
                total.unshift(sum);
                carry = 0;
            }
        }
        return total.join("");
    }
    return quotient.join("");
}

for (let i = 0; i < testCase; i++) {
    var n = readline().trim().split('').map(Number);
    var result;
    var sum = 0;
    for (let i = 0; i < n.length; i++) {
        sum += n[i];
    }
    var divisiblebyfour = n.length < 2 ? n[n.length - 1] : ((n[n.length - 2] * 10) + n[n.length - 1]);
    if (n[n.length - 1] % 2 !== 0) {
        console.log(-1);
    } else if (n.length < 2 && n[n.length - 1] < 4) {
        console.log(-1);
    } else {
        console.log(division(n, 6), division(n, 4));
    }
}
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {
var testCase = parseInt(readline());

function division(n, divisor) {
    var remainder;
    var dividend = n[0];
    var quotient = [];

    for (let i = 0; i < n.length; i++) {
        if (dividend < divisor) {
            quotient.push(Math.floor(dividend / divisor));
            remainder = dividend;
            dividend = (remainder * 10) + n[i + 1];
        } else {
            quotient.push(Math.floor(dividend / divisor));
            remainder = dividend % divisor;
            dividend = (remainder * 10) + n[i + 1];
        }
    }

    if (quotient[0] === 0) {
        quotient.shift();
    }
    if (divisor === 6 && remainder > 0) {
        return Number(quotient.join("")) + 1;
    }
    return quotient.join("");
}

for (let i = 0; i < testCase; i++) {
    var n = readline().trim().split('').map(Number);
    var result;
    var sum = 0;
    for (let i = 0; i < n.length; i++) {
        sum += n[i];
    }
    var divisiblebyfour = n.length < 2 ? n[n.length - 1] : ((n[n.length - 2] * 10) + n[n.length - 1]);
    if (n[n.length - 1] % 2 !== 0) {
        console.log(-1);
    } else if (n.length < 2 && n[n.length - 1] < 4) {
        console.log(-1);
    } else {
        console.log(division(n, 6), division(n, 4))
    }
}
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {
var testCase = parseInt(readline());

function division(n, divisor) {
    var remainder;
    var dividend = n[0];
    var quotient = [];

        for (let i = 0; i < n.length; i++) {
            if (dividend < divisor) {
                quotient.push(Math.floor(dividend / divisor));
                remainder = dividend;
                dividend = (remainder * 10) + n[i + 1];
            } else {
                quotient.push(Math.floor(dividend / divisor));
                remainder = dividend % divisor;
                dividend = (remainder * 10) + n[i + 1];
            }
        }

    if (quotient[0] === 0) {
        quotient.shift();
    }
    if (divisor === 6 && remainder > 0) {
        return Number(quotient.join("")) + 1;
    }
    return quotient.join("");
}

for (let i = 0; i < testCase; i++) {
    var n = readline().trim().split('').map(Number);
    var result;
    var sum = 0;
    for (let i = 0; i < n.length; i++) {
        sum += n[i];
    }
    var divisiblebyfour = n.length < 2 ? n[n.length - 1] : ((n[n.length - 2] * 10) + n[n.length - 1]);
    if (n[n.length - 1] % 2 !== 0) {
        console.log(-1);
    } else {
        console.log(division(n, 6), division(n, 4))
    }
}
}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {
var testCase = parseInt(readline());

function division(n, divisor) {
    var remainder;
    var dividend = n[0];
    var quotient = [];
    if (n.length < 2) {
        quotient.push(n[0] / divisor);
        return quotient.join("");
    } else {
        for (let i = 0; i < n.length; i++) {
            if (dividend < divisor) {
                quotient.push(Math.floor(dividend / divisor));
                remainder = dividend;
                dividend = (remainder * 10) + n[i + 1];
            } else {
                quotient.push(Math.floor(dividend / divisor));
                remainder = dividend % divisor;
                dividend = (remainder * 10) + n[i + 1];
            }
        }
    }
    if (quotient[0] === 0) {
        quotient.shift();
        return quotient.join("");
    }else{
        return quotient.join("");
    }
}

for (let i = 0; i < testCase; i++) {
    var n = readline().trim().split('').map(Number);
    var result;
    var sum = 0;
    for (let i = 0; i < n.length; i++) {
        sum += n[i];
    }
    var divisiblebyfour = n.length < 2 ? n[n.length - 1] : ((n[n.length - 2] * 10) + n[n.length - 1]) ;
    if ((divisiblebyfour % 4 !== 0) && !(sum % 3 === 0 && n[n.length - 1] % 2 === 0)) {
        console.log(-1);
    }else if ((divisiblebyfour % 4 === 0) && !(sum % 3 === 0 && n[n.length - 1] % 2 === 0)) {
        result = division(n, 4);
        console.log(result, result);
    }else if ((divisiblebyfour % 4 !== 0) && (sum % 3 === 0 && n[n.length - 1] % 2 === 0)) {
        result = division(n, 6);
        console.log(result, result);
    }else if((divisiblebyfour % 4 === 0) && (sum % 3 === 0 && n[n.length - 1] % 2 === 0)){
        console.log(division(n, 6), division(n, 4));
    }
}
}

const solve = (str)=>{
     let n = BigInt(str);
     let min = 6n;
     let max = 4n;
     if(n%2n===1n) return -1;
     let r1 = n%min,r2 = n%max;
     r1 = r1>0n ? (n/min)+1n : n/min;
     r2 = n/max;
     return `${r1} ${r2}`;
}
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();
       console.log(solve(n));
  }
}
main();

const solve = (str)=>{
     let n = BigInt(str);
     let min = BigInt(6);
     let max = BigInt(4);
     if(n%min===BigInt(0)) min = n/min;
     else min = 1;
     if(n%max===BigInt(0)) max = n/max;
     else max = 1;
     if(min===max) return -1;
     else return `${min} ${max}`;
}
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();
       console.log(solve(n));
  }
}
main();

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 = BigInt(lines[l++])
        output[i] = solve(n)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n) {
    if (n & 1n) return -1
    const a = n / 4n
    const b = ceil(n, 6n)
    return b + ' ' + a
}
function ceil(a, b) {
    const r = a % b
    const f = a / b
    return r ? f + 1n : f
}

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

let lines = 0;
const maxBuses = (n) => {
  switch (n % 4n) {
    case 0n:
      return n / 4n;
    case 1n:
      return -1;
    case 2n:
      return (n - 4n) / 4n + 1n;
    case 3n:
      return -1;
  }
};
const minBuses = (n) => {
  switch (n % 6n) {
    case 0n:
      return n / 6n;
    case 1n:
      return -1;
    case 2n:
      return (n - 6n) / 6n + 2n;
    case 3n:
      return -1;
    case 4n:
      return n / 6n + 1n;
    case 5n:
      return -1;
  }
};

rl.on("line", function (line) {
  if (lines !== 0) {
    const input = BigInt(line);
    const min = minBuses(input);
    const max = maxBuses(input);
    if (min === -1 && max === -1) {
      return console.log("-1");
    }
    console.log(min.toString(), max.toString());
  }
  lines++;
});

'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) {
  if (n % 2n !== 0n) return '-1';
  let min = 0n,
      max = 0n;
  for (let i = 0n; i < n; i++) {
    if ((n - 4n * i) % 6n === 0n) {
      min = i + (n - 4n * i) / 6n;
      break;
    }
  }
  for (let i = 0n; i < n; i++) {
    if ((n - 6n * i) % 4n === 0n) {
      max = i + (n - 6n * i) / 4n;
      break;
    }
  }
  return `${min.toString()} ${max.toString()}`;
}

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

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

let ls = [];

function solve() {
    let l = 0;
    let t = parseInt(ls[l++]);
    for (; t > 0; t--){
        const n = parseInt(ls[l++]);
        if (n % 2 == 1 || n < 4){
            console.log(-1);
            continue;
        }

        let x = n % 6 == 0 ? n / 6 : Math.floor(n / 6) + 1;
        let y = Math.floor(n / 4);
        console.log(`${x} ${y}`);
    }
}

rl.on('line', (l) => ls.push(l));
rl.on('close', () => 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());
}
function iInpArr1() {
  return readline()
    .trim()
    .split("")
    .map((cur) => parseInt(cur));
}
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 sqrt = (n) => {
  let low = 1n,
    high = n,
    ans;
  while (low <= high) {
    let mid = (low + high) / 2n;
    if (mid * mid <= n) {
      ans = mid;
      low = mid + 1n;
    } else high = mid - 1n;
  }
  return ans;
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    if (n === 1) console.log(0);
    else {
      let ans = [],
        prev = 0 ^ arr[0];
      ans.push(0);
      for (let i = 1; i < n; i++) {
        let p1 = new Array(30).fill(0);
        let p2 = new Array(30).fill(0);
        let j = arr[i],
          k = 0,
          l = prev;
        while (j > 0) {
          if (j & 1) p1[k] = 1;
          j = j >> 1;
          k++;
        }
        k = 0;
        while (l > 0) {
          if (l & 1) p2[k] = 1;
          l = l >> 1;
          k++;
        }
        let res = 0;
        for (let j = 0; j < 30; j++) {
          if (p2[j] === 1 && p1[j] === 0) res += 1 << j;
        }
        ans.push(res);
        prev = res ^ arr[i];
      }
      console.log(ans.join(" "));
    }
  }
};
solve();

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let numbers = +input[z++];
        let arr = input[z++].split(' ').map(Number);
        let binaryArr = [];
        let resultArr = [];

        arr.forEach(element => {
            binaryArr.push(element.toString(2));
        });
        let newBinaryarr = [];
        newBinaryarr.push(binaryArr[0])
        for (let i = 0; i < binaryArr.length; i++) {
            if(i === 0){
                resultArr.push(0);
            }
            else{
                let temp1 = newBinaryarr[i-1].toString().length;
                let temp2 = binaryArr[i].toString().length;
                if(temp1 > temp2){
                    binaryArr[i] = '0'.repeat(temp1 - temp2) + binaryArr[i];
                }
                else{
                    newBinaryarr[i-1] = '0'.repeat(temp2 - temp1) + newBinaryarr[i - 1];
                }
                let max = Math.max(temp1, temp2);
                let pow = 0;
                let total = 0;

                for (let j = max - 1; j >= 0; j--) {
                    if(newBinaryarr[i-1][j] == 1 && binaryArr[i][j] != 1){
                        total += Math.pow(2, pow);
                        pow++;
                    }
                    else{
                        pow++;
                    }
                }
                newBinaryarr.push((total + arr[i]).toString(2));
                resultArr.push(total);
            }
        }
        console.log(resultArr.join(' '));
    }
}

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

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

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const x = rna();

		const ans = [0];
		for (let i = 1, prev = x[0]; i < n; i++) {
			ans[i] = ~x[i] & prev;
			prev = x[i] ^ ans[i];
		}

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

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

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

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

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

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

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

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

function solve() {
   const n = Number(read());
   let maxlen = 0;
   const x = readArray((x) => {
      const binx = decToBin(Number(x));
      if (binx.length > maxlen) {
         maxlen = binx.length;
      }
      return binx;
   });
   const ans = [[0]];
   const a = [x[0]];
   for (let i = 1; i < n; i++) {
      ans.push([]);
      a.push([]);
      for (let j = maxlen - 1; j >= 0; j--) {
         ans[i][j] = a[i - 1][j] && !x[i][j] ? 1 : 0;
         a[i][j] = (x[i][j] ^ ans[i][j]);
      }
   }
   write(ans.map(binToDec).join(' '));
}

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

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 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 l = 0;
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        l++
        var arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(arr))
    }
});

function solve(arr) {
    let prev
    return arr.map((x, idx) => {
        if (idx) {
            let mask = 1
            let r = 0
            let next = 0
            for (let i = 0; i < 31; i++) {
                if (prev & mask) {
                    if (!(x & mask)) {
                        r |= mask
                    }
                } else {
                    // prefer 0 in r
                }
                next |= ((r & mask) ^ (x & mask))
                mask += mask
            }
            prev = next
            return r
        } else {
            prev = x
            return 0
        }
    }).join(' ')
}

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
// import * as readline from 'readline'
// const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
// const ask = (query: string) => new Promise<string>((resolve) => rl.question(query, resolve))
// // Don't forget `rl.close()`.
const INT = Math.floor;
Array.prototype.last = function () {
    return this.length === 0 ? undefined : this[this.length - 1];
};
Array.prototype.isEmpty = function () {
    return this.length === 0;
};
const less = (a, b) => (a == b ? 0 : a < b ? -1 : 1);
const greater = (a, b) => (a == b ? 0 : a < b ? 1 : -1);
const bigIntMax = (...args) => args.reduce((m, e) => (e > m ? e : m));
const bigIntMin = (...args) => args.reduce((m, e) => (e < m ? e : m));
const bigIntAbs = (arg) => (arg < 0 ? -arg : arg);
function read_stdin() {
    return fs.readFileSync(process.env.NODE_ENV === 'debug' ? stdin : process.stdin.fd, 'utf8');
}
class Input {
    constructor(str) {
        this.index = 0;
        this.inputs = (str ? str : read_stdin()).split(/\s+/);
    }
    number() {
        return Number(this.inputs[this.index++]);
    }
    numbers(n) {
        return this.inputs.slice(this.index, (this.index += n)).map(Number);
    }
    bigint() {
        return BigInt(this.inputs[this.index++]);
    }
    bigints(n) {
        return this.inputs.slice(this.index, (this.index += n)).map(BigInt);
    }
    word() {
        return this.inputs[this.index++];
    }
    words(n) {
        return this.inputs.slice(this.index, (this.index += n));
    }
}
function array(len, init) {
    return Array(len).fill(init);
}
function array2(h, w, init) {
    return array(h, 0).map(() => array(w, init));
}
function main() {
    const input = new Input();
    const t = input.number();
    const ans = Array(t);
    for (let i = 0; i < t; i++) {
        const n = input.number();
        const X = input.numbers(n);
        const Y = Array(n);
        let prev = 0;
        for (let j = 0; j < n; j++) {
            if ((prev & X[j]) === prev) {
                Y[j] = 0;
                prev = X[j];
            }
            else {
                const tmp = prev | X[j];
                Y[j] = tmp ^ X[j];
                prev = tmp;
            }
        }
        ans[i] = Y;
    }
    console.log(ans.map((Y) => Y.join(' ')).join('\n'));
}
main();
//# sourceMappingURL=aoj.js.map

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let numbers = +input[z++];
        let arr = input[z++].split(' ').map(Number);
        let binaryArr = [];
        let resultArr = [];

        arr.forEach(element => {
        binaryArr.push(convertToBinary(element))});

        function convertToBinary(element){
            let bin = 0;
            let rem, i = 1, step = 1;
            while (element != 0) {
                rem = element % 2;
                element = parseInt(element / 2);
                bin = bin + rem * i;
                i = i * 10;
            }
            return bin.toString();
        };

        let newBinaryarr = [];
        newBinaryarr.push(binaryArr[0])
        for (let i = 0; i < binaryArr.length; i++) {
            if(i === 0){
                resultArr.push(0);
            }
            else{
                let temp1 = newBinaryarr[i-1].toString().length;
                let temp2 = binaryArr[i].toString().length;
                if(temp1 > temp2){
                    binaryArr[i] = '0'.repeat(temp1 - temp2) + binaryArr[i];
                }
                else{
                    newBinaryarr[i-1] = '0'.repeat(temp2 - temp1) + newBinaryarr[i - 1];
                }
                let max = Math.max(temp1, temp2);
                let pow = 0;
                let total = 0;

                for (let j = max - 1; j >= 0; j--) {
                    if(newBinaryarr[i-1][j] == 1 && binaryArr[i][j] != 1){
                        total += Math.pow(2, pow);
                        pow++;
                    }
                    else{
                        pow++;
                    }
                }
                newBinaryarr.push((total + arr[i]).toString(2));
                resultArr.push(total);
            }
        }
        console.log(...resultArr);
    }
}


// ################## //
// 11th October 2019. //
// ################## //

// ####################################################################### //
// Letters of the english alphabet.
const letters = 'abcdefghijklmnopqrstuvwxyz';
// Method to generate bitmasks indicating presence of letters.
function generateBitmaskFor(word){
  var bitmask = '';
  for(var x = 0;x<letters.length;++x){
    if(word.includes(letters[x])) bitmask+='1';
    else bitmask+='0';
  }
  return bitmask;
}
// Generating bitmasks for words given by codeforces.
var wordCount = parseInt(readline());
var wordBitmasks = readline().split(' ').map(function(e){
  return generateBitmaskFor(e);
});
// Solution.
print((new Set(wordBitmasks).size));
// ####################################################################### //

                                 // ###################################### //
                                 // Programming-Credits atifcppprogrammer. //
                                 // ###################################### //

var n = readline();
var words = readline().split(" ");

var keys = {};

words.forEach(function (word) {
    keys[clean(word)] = true;
});

print(Object.keys(keys).length);

function clean(word) {
    var keys = {};
    for (var i = 0; i < word.length; i++) {
        keys[word[i]] = true;
    }
    return Object.keys(keys).sort().join();
}


var input = readline().split(" "), a = +input[0], b = +input[1];
var n = +readline();

var minT = Infinity;
for(var i = 0; i < n; i++){
    var data = readline().split(" ").map(Number);
    var x = data[0], y = data[1], v = data[2];
    var s = Math.sqrt( Math.pow( (a-x), 2 ) + Math.pow( (b-y), 2 ) );
    minT = Math.min(minT, s/v);
}

write(minT);

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

const distance = (x1, x2, y1, y2) => {
  return Math.abs(Math.sqrt((x1 - y1)**2 + (x2 - y2) ** 2));
}

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [a, b] = d.split(' ').map(Number);
    return;
  }

  if (c === 1) {
    c++;
    return;
  }

  const [x, y, v] = d.split(' ').map(Number);
  ans = Math.min(ans, distance(a, b, x, y) / v);

  c++;
});

rl.on('close', () => {
  console.log(ans.toFixed(6));
});

var input = readline().split(' ').map(Number);
var a = input[0], b = input[1];
var n = +readline();
var res = Infinity;
for (var i = 0; i < n; i++) {
    input = readline().split(' ').map(Number);
    var x = input[0], y = input[1], v = input[2];
    res = Math.min(Math.sqrt(Math.pow(a-x, 2) + Math.pow(b-y, 2)) / v, res)
}
print(res);

var input = readline().split(' ').map(Number);
var a = input[0], b = input[1];
var n = Number(readline());
var res = 10000000;
for (var i = 0; i < n; i++) {
    input = readline().split(' ').map(Number);
    var x = input[0], y = input[1], v = input[2];
    res = Math.min(Math.sqrt(Math.pow(a-x, 2) + Math.pow(b-y, 2)) / v, res)
}
print(res);

'use strict';

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var tArr = [];

var _readline$split$map = readline().split(' ').map(Number);

var _readline$split$map2 = _slicedToArray(_readline$split$map, 2);

var a = _readline$split$map2[0];
var b = _readline$split$map2[1];

var n = Number(readline());
for (var i = 0; i < n; i++) {
  var _readline$split$map3 = readline().split(' ').map(Number);

  var _readline$split$map4 = _slicedToArray(_readline$split$map3, 3);

  var x = _readline$split$map4[0];
  var y = _readline$split$map4[1];
  var v = _readline$split$map4[2];

  tArr.push(Math.sqrt(Math.pow(x - a, 2) + Math.pow(y - b, 2)) / v);
}
print(Math.min.apply(Math, tArr));

'use strict';

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var _readline$split$map = readline().split(' ').map(Number);

var _readline$split$map2 = _slicedToArray(_readline$split$map, 2);

var a = _readline$split$map2[0];
var b = _readline$split$map2[1];

var n = Number(readline());
var minTime = 100000;
for (var i = 0; i < n; i++) {
	var _readline$split$map3 = readline().split(' ').map(Number);

	var _readline$split$map4 = _slicedToArray(_readline$split$map3, 3);

	var x = _readline$split$map4[0];
	var y = _readline$split$map4[1];
	var v = _readline$split$map4[2];

	var dist = Math.sqrt((x - a) * (x - a) + (y - b) * (y - b));
	var time = dist / v;
	if (minTime > time) {
		minTime = time;
	}
}
print(minTime);

var input = readline().split(" ").map(i => +i);
var a = input[0];
var b = input[1];
var n = +readline();
var minTime;

var distance = function(x1, y1, x2, y2) {
    return Math.sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
};

for (var i = 0; i < n; ++i) {
    input = readline().split(" ").map(i => +i);
    var xi = input[0];
    var yi = input[1];
    var vi = input[2];
    var time = distance(xi, yi, a, b) / vi;
    if ( typeof minTime === "undefined" || time < minTime) {
        minTime = time;
    }
}

print(minTime);

var input = readline().split(" ").map(i => +i);
var a = input[0];
var b = input[1];
var n = +readline();
var minTime;

var distance = function(x1, y1, x2, y2) {
    return Math.sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
};

for (var i = 0; i < n; ++i) {
    input = readline().split(" ").map(i => +i);
    var xi = input[0];
    var yi = input[1];
    var vi = input[2];
    var time = distance(xi, yi, a, b) / vi;
    if ( !minTime || time < minTime) {
        minTime = time;
    }
}

print(minTime);


var g = readline().split(" ");
var m = Number(g[1]);
var n = Number(g[0]);

var print_dots = [];

var input_dots = [];

for(i=0;i<n;i++){
    input_dots.push(readline());

}

for(dott=1;dott<=m;dott++){
    var dott_flag = true;
    for(i=0;i<n;i++){
        var k = input_dots[i].split(" ");
        var l = Number(k[0]);
        var r = Number(k[1]);
        if(dott >= l && dott <= r){
            dott_flag =false;
            break;
         }
    }

   if(dott_flag)
    print_dots.push(dott);
}

print(print_dots.length);
print(print_dots.join(" "));

var a = readline().split(' ');
var arr = [],result = [];
for(var i = 0;i <a[0]; i++){
    arr.push(readline().split(' '));
}
for(var i = 1; i <= a[1]; i++){
    var k = 0;
    for(var j = 0; j<a[0] ;j++){
        if(i<arr[j][0] || i>arr[j][1]){
            k++;
        }
    }
    if(k == a[0]) result.push(i);
}
print(result.length);
result.forEach(function(v){
    print( v + ' ');
});

var input = readline();
var items = input.split(' ');

var lines = items[0];
var top1 = items[1];

var inputs = [];
var y = [];
for (var i = 1; i <= lines; i++ ){
    inputs = readline().split(' ');

    for (var j = +inputs[0]; j <= +inputs[1]; j++ ) {
        if (y.indexOf(j) === -1) {
            y.push(j);
        }
    }
}

print(top1 - y.length);

for (var i = 1; i <= top1; i++) {
    if (y.indexOf(i) === -1) {
        write(i + ' ');
    }
}

function calculateProb(str1, str2) {
    var ob = {};
    var rez = [];
    var last = '';

    for (var k = 1; k <= str2; k++) {
        var flg = true;

        for (var i = 0; i < str1.length; i++) {
            if (!(k < parseInt(str1[i][0]) || k > parseInt(str1[i][1]))) {
                flg = false;
            }
        }

        if (flg) rez.push(k);
    }

    print(rez.length);
    print(rez.join(" "));
}

var s = [];
var s1 = readline().split(' ');

var num = parseInt(s1[0]);
var num2 = parseInt(s1[1]);

for (var i = 0; i < num; i++) {
    s.push(readline().split(' '));
}

calculateProb(s, num2);

function main() {
  const is = new Scanner();
  const [n, m] = is.nextArray(Number);
  const line = new Array(m).fill(true);
  let u, v;
  for (let i = 0; i < n; i += 1) {
    [u, v] = is.nextArray(Number);
    u -= 1; v -= 1;
    while (u <= v) {
      line[u] = false;
      u += 1;
    }
  }

  const segments = [];
  line.forEach((item, index) => {
    if (item) {
      segments.push(index + 1);
    }
  });

  console.log(segments.length);
  if (segments.length) {
    console.log(segments.join(' '));
  }
}

/*
 *  Api Scanner
 */
class Scanner {
  constructor() {
    this.index = 0;
    this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
  }

  nextLine() {
    return this.lines[this.index++]; // eslint-disable-line
  }

  nextInt() {
    return parseInt(this.nextLine(), 10);
  }

  nextDouble() {
    return parseFloat(this.nextLine());
  }

  nextArray(fn) {
    const array = this.nextLine().split(' ');
    return fn === String ? array : array.map(fn);
  }

  hasNext() {
    return this.index < this.lines.length;
  }
}

let stdinInput = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => { stdinInput += input; });
process.stdin.on('end', () => { main(); });

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

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

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

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(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}

function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

function main(input) {
  let ptr = 0
  const [n,m] = readInts(input, ptr++)
  const arr = new Array(n)
  for(let i = 0; i < n; i++) {
    arr[i] = readInts(input, ptr++)
  }

  arr.sort((a, b) => {
    if(a[0] === b[0]) return a[1] - b[1]
    else return a[0] - b[0]
  })
  let ans = []
  let last = 0
  // console.log(arr)
  arr.forEach(e => {
    if(last < e[0]) {
      let t = last + 1
      while(t < e[0]) {
        ans.push(t)
        t++
      }
    }
    if(last < e[1]) last = e[1]
  })
  if(last < m) {
    let t = last + 1
    while(t <= m) {
      ans.push(t)
      t++
    }
  }

  wr(ans.length)
  if(ans.length !== 0) wr(ans.join(' '))
  else console.log()
}

//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↑入力 ↓出力');
	Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : 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 one = nextIntArray();
	var N = one[0];
	var M = one[1];
	var used = new Array(M + 1).fill(0);
	for(var i = 0; i < N; i++){
		var tmp = nextIntArray();
		for(var j = tmp[0]; j <= tmp[1]; j++){
			used[j]++;
		}
	}
	var output = [];
	for(var i = 1; i <= M; i++){
		if(used[i] == 0){
			output.push(i);
		}
	}
	myout(output.length);
	myout(myconv(output, 8));
}

function main() {
    [n, m] = readInts()
    st = new Set()
    for (i=1; i<=m; i++) st.add(i)
    for (i=0; i<n; i++){
        [l, r] = readInts()
        for (j=l; j<=r; j++) st.delete(j)
    }
    print(st.size)
    print(Array.from(st).join(' '))
}

const TESTCASES = false
/* 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)}

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

rl.on('line', (d) => {
  if (c === 0) {
    [n, m] = d.split(' ').map(Number);
    segment = new Array(m + 1).fill(1);
    c++;
    return;
  }

  let [l, r] = d.split(' ').map(Number);

  while (l <= r) {
    segment[l] = 0;
    l++;
  }

  c++;
});

rl.on('close', () => {
  let k = segment.reduce((a, x) => a + x, 0);
  const ans = [];
  console.log(k - 1);

  if (k) {
    for (let i = 1; i < segment.length; i++) {
      if (segment[i] === 1) {
        ans.push(i);
      }
    }
  }

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

let input = [];

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

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

RL.on('close', () => {
    let {0:n, 1:m} = {...input[0].split(' ')};
    n = parseInt(n); m = parseInt(m);

    let answer = [];
    for(let i = 0; i < m; i++)
        answer[i] = 0;
    //console.log(`n = ${n}; m = ${m};`);
    for(let i = 0; i < n; i++){
        let pair = []; input[i+1].split(' ').forEach(j => pair.push(parseInt(j)));

        for(let j = pair[0]; j <= pair[1]; j++){
            answer[j-1] = 1;
        }
    }

    let cnt = 0;
    let answer_string = '';
    for(let i = 0; i < m; i++){
        if(answer[i] == 0){
            answer_string += `${i+1} `; cnt++;
        }

    }
    console.log(cnt);
    if (cnt > 0)
        console.log(answer_string);
});

'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 inp() {
    return inputString[currentLine++];
}

function out(str) {
    console.log(str);
}

function stringArrayToNumbers(str) {
    var array = str.split(" ");
    var result = [];
    for( var i = 0; i < array.length; i++ ) {
        result.push( parseInt(array[i]) );
    }
    return result;
}
function main() {
    let n1= stringArrayToNumbers(inp())
    let n, m, i, j, l, r;

    n = n1[0];
    m = n1[1];
    var arr= []
    for (i = 1; i<=m; i++)
    {
        arr.push(0)
    }
    for(i=1; i<=n; i++) {
        let inputs = inp();
        inputs = inputs.split(' ');
        l = parseInt(inputs[0], 10);
        r = parseInt(inputs[1], 10);
        for (j=l-1; j<r; j++){
            arr[j]=1
        }
    }
    var ans = []
    for(i=0; i<m; i++){
        if (arr[i]==0){
            ans.push(i+1)
        }
    }
    out(ans.length);
    var ans1 = '';
    for (i=0; i<ans.length; i++){
        ans1 += ans[i]+' '
    }
    out(ans1)

}

var a = readline().split(' ');
var arr = [],result = [];
for(var i = 0;i <a[0]; i++){
    arr.push(readline().split(' '));
}
for(var i = 1; i <= a[1]; i++){
    var k = 0;
    for(var j = 0; j<a[0] ;j++){
        if(i<arr[j][0] && i<arr[j][1]){
            k++;
        }
    }
    if(k == a[0]) result.push(i);
}
print(result.length);
result.forEach(function(v){
    print(v+ ' ');
})

var a = readline().split(' ');
var arr = [],result = [];
for(var i = 0;i <a[0]; i++){
    arr.push(readline().split(' '));
}
for(var i = 1; i <= a[1]; i++){
    var k = 0;
    for(var j = 0; j<a[0] ;j++){
        if(i<arr[j][0] && i>arr[j][1]){
            k++;
        }
    }
    if(k == a[0]) result.push(i);
}
print(result.length);
result.forEach(function(v){
    print( v + ' ');
});

function main() {
  const is = new Scanner();
  const [n, m] = is.nextArray(Number);
  const line = new Array(m).fill(true);
  let u, v;
  for (let i = 0; i < n; i += 1) {
    [u, v] = is.nextArray(Number);
    u -= 1; v -= 1;
    while (u <= v) {
      line[u] = false;
      u += 1;
    }
  }

  const segments = [];
  line.forEach((item, index) => {
    if (item) {
      segments.push(index);
    }
  });

  console.log(segments.length);
  if (segments.length) {
    console.log(segments.join(' '));
  }
}

/*
 *  Api Scanner
 */
class Scanner {
  constructor() {
    this.index = 0;
    this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
  }

  nextLine() {
    return this.lines[this.index++]; // eslint-disable-line
  }

  nextInt() {
    return parseInt(this.nextLine(), 10);
  }

  nextDouble() {
    return parseFloat(this.nextLine());
  }

  nextArray(fn) {
    const array = this.nextLine().split(' ');
    return fn === String ? array : array.map(fn);
  }

  hasNext() {
    return this.index < this.lines.length;
  }
}

let stdinInput = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => { stdinInput += input; });
process.stdin.on('end', () => { main(); });

function main() {
  const is = new Scanner();
  const [n, m] = is.nextArray(Number);
  const line = new Array(m + 2).fill(true);
  let u, v;
  for (let i = 0; i < n; i += 1) {
    [u, v] = is.nextArray(Number);
    while (u <= v) {
      line[u] = false;
      u += 1;
    }
  }

  const segments = [];
  let flag = false;
  let numSegments = 0;
  line[m + 1] = false;
  for (let i = 1; i < line.length; i += 1) {
    switch (true) { // eslint-disable-line
      case line[i]:
        if (!flag) {
          flag = true;
          u = i;
        }
        if (i <= m)
          numSegments += 1;
        break;
      case flag:
        v = i - 1;
        flag = false;
        segments.push([u, v]);
        break;
    }
  }

  console.log(numSegments);
  if (segments.length) {
    segments.forEach((item) => {
      console.log(item[0], item[1]);
    });
  }
}

/*
 *  Api Scanner
 */
class Scanner {
  constructor() {
    this.index = 0;
    this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
  }

  nextLine() {
    return this.lines[this.index++]; // eslint-disable-line
  }

  nextInt() {
    return parseInt(this.nextLine(), 10);
  }

  nextDouble() {
    return parseFloat(this.nextLine());
  }

  nextArray(fn) {
    const array = this.nextLine().split(' ');
    return fn === String ? array : array.map(fn);
  }

  hasNext() {
    return this.index < this.lines.length;
  }
}

let stdinInput = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => { stdinInput += input; });
process.stdin.on('end', () => { main(); });

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

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

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

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(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}

function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

function main(input) {
  let ptr = 0
  const [n,m] = readInts(input, ptr++)
  const arr = new Array(n)
  for(let i = 0; i < n; i++) {
    arr[i] = readInts(input, ptr++)
  }

  arr.sort((a, b) => {
    if(a[0] === b[0]) return a[1] - b[1]
    else return a[0] - b[0]
  })
  let ans = []
  let last = 0
  arr.forEach(e => {
    if(last < e[0]) {
      let t = last + 1
      while(t < e[0]) {
        ans.push(t)
        t++
      }
    }
    if(last < e[1]) last = e[1]
  })

  wr(ans.length)
  if(ans.length !== 0) wr(ans.join(' '))
}

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

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

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

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(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}

function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

function main(input) {
  let ptr = 0
  const [n,m] = readInts(input, ptr++)
  const arr = new Array(n)
  for(let i = 0; i < n; i++) {
    arr[i] = readInts(input, ptr++)
  }

  arr.sort((a, b) => {
    if(a[0] === b[0]) return a[1] - b[1]
    else return a[0] - b[0]
  })
  let ans = []
  let last = 0
  arr.forEach(e => {
    if(last < e[0]) {
      let t = last + 1
      while(t < e[0]) {
        ans.push(t)
        t++
      }
    }
    last = e[1]
  })

  wr(ans.length)
  if(ans.length !== 0) wr(ans.join(' '))
}