Problem B - Unattainable Numbers

In the fall of 1989 Paul Loomis was a sophomore at Wabash College. During an uninspiring lecture, he tried to find an interesting number sequence. And he found something he liked! Imagine the following function:

f(n) = n + (the product of the nonzero digits of n) 

If we begin with the number 1, by iterating f, we obtain the following sequence:

1, 2, 4, 8, 16, 22, 26, 38, 62, 74, 102, 104, 108, (...)

For example, from 22, we get f(22) = 22 + 2*2 = 22 + 4 = 26. And then, f(26) = 26 + 2*6 = 26 + 12 = 38. When he have zeros, we ignore them in the product, as we said before. For example, f(102) = 102 + 1*2 = 104. If we start with another number, we have another sequence that eventually hits a number in the first sequence we gave. For example, if we start with 5 or 19:

5, 10, 11, 12, 14, 18, 26, (...)
19, 28, 44, 60, 66, 102, (...)

However, some numbers are "unattainable" in the sense that for obtaining them using the function described before, we must use them as the starting number. More formally, a number n is unattainable if there exists no m > 0, such that f(m) = n (the same as saying there exists no m > 0 such that m + (the product of the nonzero digits of m) = n). For example, 1, 5 and 19 are unattainable numbers.

The Problem

For a given number, you have to discover if it is an unattainable one.

Input

In the first line of input comes an integer number C, indicating the quantity of numbers to evaluate (1 ≤ C ≤ 10 000).

Then follow exactly C lines, each one with one integer N, indicating the numbers you should evaluate (1 ≤ N ≤ 1 000 000).

Output

The output has exactly C lines, each one indicating if the respective number is unattainable, in the following format:

N is unattainable
or
N is not unattainable

See the sample input and output for a concrete example.

Sample Input

7
1
74
11
5
19
63
66

Sample Output

1 is unattainable
74 is not unattainable
11 is not unattainable
5 is unattainable
19 is unattainable
63 is unattainable
66 is not unattainable

TIUP & CPUP 2007
Universidade do Porto
(30 de Maio de 2007)