P10709 [HackerEarth] panda and numbers
普及
题目描述

Panda is fond of numbers. Given a number, he subtracts it with squares of any one particular digit of that number to get new numbers. This operation can be applied any number of times (possibly zero) till he obtains a pandatic number. If he is able to reach to a pandatic number then he wins. A pandatic number is a number which can be expressed in the form A^A, where A is a positive integer.

Input Format:
The first line will contain T, the number of test cases.
Then T lines follow, each containing an integer N.

Output Format:
For each test case, output whether it's possible for panda to reach a pandatic number by doing the operations as described. If it's possible print "Yes" (without quotes), otherwise print "No" (without quotes).

Constraints:
Subtask 1: (10 points)
1 ≤ T ≤ 10^3
1 ≤ N ≤ 10^3
Subtask 2: (90 points)
1 ≤ T ≤ 10^5
1 ≤ N ≤ 10^6

SAMPLE INPUT
3
1
3
13

SAMPLE OUTPUT
Yes
No
Yes

Explanation

Case 1: 1 is a pandatic number, hence the answer is "Yes".
Case 2: 3 is not a pandatic number, the answer for this is "No". 3 - 3^3 = -6 is also not a "pandatic number". Hence the final answer is "No".
Case 3: 13 is not a pandatic number.
13 - 1^2 = 12 is not a pandatic number.
13 - 3^2 = 4 is a pandatic number.
.
.
.
Hence the final answer is "Yes".

输入格式

见题面

输出格式

见题面

样例输入
3 1 3 13 SAMPLE
样例输出
Yes No Yes