Masala #MNDV0FDD6D

Xotira 32 MB Vaqt 2000 ms
14

Beautiful numbers

A four-digit number \(ABCD \) is beautiful if \(AB^2 + CD^2 \)when divided by \(7\) gives a remainder of \(1\).

For example, the number \(2843 \) is beautiful because

\(28^2 + 43^2 = 2633 = 376 * 7 + 1.\)

You are given \(t\) four-digit numbers, print \(YES \)for each number if the number is beautiful and \(NO\), otherwise


Kiruvchi ma'lumotlar:

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


Chiquvchi ma'lumotlar:

If the number is nice, print \(YES\), otherwise \(NO\).


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