Grandparents

No attempts yetTime limit1sMemory limit128 MB

Problem

A grandfather and a grandmother are NN years old in total. The grandfather's current age is twice the grandmother's age back when the grandfather was as old as the grandmother is now. How old is the grandmother?

Input

The first line contains an integer TT, the number of test cases. Each of the next TT lines contains one positive integer NN, the combined age of the two grandparents. NN does not exceed an upper limit GG.

Output

For each test case, print the grandmother's age rounded to the nearest integer, one per line — unless the test number (counting from 11) is divisible by XX, in which case print AMPPZ 2010 on that line instead (the quotation marks are only for emphasis and must not appear in the output).

Constraints

  • XX — the largest integer whose square and cube, written side by side, together use every digit from 00 to 99 exactly once.
  • GG — equal to 22i22 \cdot i, where ii is the fourth number from the left of the ninth sequence, in lexicographic order, among all ways of filling a 3×33\times 3 square with the numbers 0,1,,80, 1, \ldots, 8 so that the sums along every row and every column are all equal. The sequence a0,,a8a_0, \ldots, a_8 corresponds to the square laid out as:
a0 a1 a2
a3 a4 a5
a6 a7 a8
  • TT — no greater than the largest divisor of A=1000036000099A = 1000036000099 that is smaller than AA.