#K82547. House Number Validation

    ID: 35999 Type: Default 1000ms 256MiB

House Number Validation

House Number Validation

In this problem, you are given a list of house numbers, each in the format of three uppercase letters followed by a positive integer (e.g. ABC1237). According to the mayor's rule, a house number is valid if and only if the sum of the ASCII values of the three letters is even, and the integer part is a prime number. Formally, let the letters be L₁, L₂, L₃ and the number be N. Then the house number is valid if

(\text{if } \sum_{i=1}^3 \operatorname{ord}(L_i) \equiv 0 ; (\bmod;2)\text{ and } N \text{ is prime.})

For each given house number, output "YES" if it is valid, and "NO" otherwise.

inputFormat

The first line of input contains an integer T, the number of test cases. The following T lines each contain a house number string.

outputFormat

For each test case, output a single line containing either "YES" if the house number is valid according to the mayor's rule, or "NO" otherwise.## sample

3
ABC1237
DEF4567
XYZ9992
YES

NO NO

</p>