MATHLOVE - Math is Love


Rashid loves mathematics. He recently started to learn how the various function works in mathematics. On his journey through the math world, he came in touch with a function named Y.

He also came to know that, here Y means the summation of number from 0 to n. For example if n = 5, then 

    Y = 0 + 1 + 2 + 3 + 4 + 5 = 15

Now he is wondering if the knows the value of Y, can he find the value of n for the above equation?

Being so very new to the math world, he could not figure out how to approach this new problem. So he came to you for help. Can you help him?

Input

First line of input will be T (1 <= T <= 100000), denoting the number of test cases.

Next T lines will contain the number Y (1 <= Y <= 3*10^9), value of the above function.

Output

For each test case, if there is exist a value of n for which the above function gives the output Y then print that value of n, otherwise print “NAI” (quotes for clarification).

Note: Data set is huge, use scanf, printf for faster input, output.

Sample

Input
5
11
15
21
1
7626

Output
NAI
5
6
1
123

hide comments
Jamil Siam: 2017-04-04 13:31:34

@ pvsmpraveen: There is no problem with the data set. Your first solution had a bug.

pvsmpraveen: 2017-04-04 08:20:21

Y is Not in between 0 and 3*10^9 as specified. (got 1 wa bcaz of that)
Got it accepted considering 0 <= Y <= 10^10


Added by:Jamil Siam
Date:2017-04-04
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All