Masala E

Xotira 32 MB Vaqt 2000 ms
14

Beautiful numbers

A four-digit number ABCDABCD  is beautiful if AB2+CD2AB^2 + CD^2 when divided by 77 gives a remainder of 11.

For example, the number 28432843  is beautiful because

282+432=2633=3767+1.28^2 + 43^2 = 2633 = 376 * 7 + 1.

You are given tt four-digit numbers, print YESYES for each number if the number is beautiful and NONO, otherwise


Kiruvchi ma'lumotlar:

The first line contains a natural number t(1t104)t (1 ≤ t ≤ 10^4). Then there are t four-digit numbers.


Chiquvchi ma'lumotlar:

If the number is nice, print YESYES, otherwise NONO.


Misollar
# input.txt output.txt
1
3
2843
8243
0100
YES
NO
YES