P13257 [CodeChef] ism05
NOI
题目描述

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

输入格式

见题面

输出格式

见题面

样例输入
3 216 121 2005
样例输出
198 NONE 1979