#K85832. Prime Palindrome Check
Prime Palindrome Check
Prime Palindrome Check
Given an integer sequence, you are to determine for each number whether it is both a prime number and a palindrome. A number (n) is considered a prime if it is greater than 1 and has no positive divisors other than 1 and itself. A number is a palindrome if it reads the same forwards and backwards. For example, numbers like (2), (11), and (131) are prime palindromes, while (121) is not because it is not prime. Solve the problem in a competitive programming style using standard input (stdin) and standard output (stdout).
inputFormat
The first line contains an integer (T) representing the number of test cases. Each of the following (T) lines contains a single integer (N) which needs to be checked.
outputFormat
For each test case, output a single line containing "YES" if (N) is both a prime and a palindrome, otherwise output "NO".## sample
4
2 11 121 131
YES
YES
NO
YES
</p>