On a Planet where people are obssessed with Numbers, they have human definitions for relation among Numbers. In one such case, they have designated a father number to be a number formed by the sum of the child number's digits along with the child number itself.
For example, for number 481, (4+8+1+481=)494 is the father.
It is of course evident, every son will have a father, but a person (number) may have any number of children, even zero.
Your task is to write a program to find the smallest child of a given integer, should it exist.


Input
Your first line of input consists of 'K' (1 ≤ K ≤ 50) test cases. The number of test cases 'K' is given in the first line of the input followed by a blank line. Each test case takes one line containing an integer N , (20 ≤ N ≤ 100,000).



Output
The output of your program will print exactly one line for each test case. The line is to contain a child of N for each test case. If X has more than one child, print the smallest. If X, however, does not have any children, print "NONE". The following shows sample input and output for three test cases.

Example

Input:

3
216
121
2005

Output:

198
NONE
1979
t=raw_input()
t=int(t)
while t:
    t-=1
    n=raw_input()
    n=int(n)
    for i in xrange(1,n):
        j=i
        sum=i
        while j:
            sum+=j%10
            j/=10
        if sum==n:
            j=-1
            break
    if j!=-1:
        print "NONE"
    else:
        print i