#P10720. Lucky Numbers

    ID: 12753 Type: Default 1000ms 256MiB

Lucky Numbers

Lucky Numbers

Little Yang believes that his lucky number must have exactly two distinct prime factors. For example, \(12 = 2 \times 2 \times 3\) has the prime factors \(2\) and \(3\) (exactly two distinct factors), so 12 is a lucky number; however, \(30 = 2 \times 3 \times 5\) has three distinct prime factors \(2, 3, 5\), so it is not a lucky number.

You are given \(n\) positive integers. For each integer, determine whether it is a lucky number. Output YES if the number is lucky, and NO otherwise.

Note: A number is considered lucky if and only if it has exactly two distinct prime factors. For example, 1 is not a lucky number, and numbers with only one prime factor (even if repeated) are not lucky.

inputFormat

The first line contains a single integer \(n\) (the number of test cases).

The second line contains \(n\) positive integers separated by spaces.

For example:

3
12 30 16

outputFormat

For each test case, output a single line containing YES if the corresponding number is lucky, and NO otherwise.

For the input example above, the output should be:

YES
NO
NO

sample

3
12 30 16
YES

NO NO

</p>