#C221. Prime Palindromic Range Finder

    ID: 45501 Type: Default 1000ms 256MiB

Prime Palindromic Range Finder

Prime Palindromic Range Finder

You are given a number of test cases. In each test case, you are provided with two integers A and B specifying the inclusive range \([A, B]\). Your task is to find all numbers in this range that are both prime and palindromic.

A number is considered a palindrome if it reads the same backwards and forwards, i.e., if you convert it to a string, it remains unchanged. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. In mathematical notation, a number \(n\) is prime if:

[ n > 1 \quad \text{and} \quad \forall d \ (1 < d < n \Rightarrow d \nmid n). ]

For each test case, if there are prime palindromic numbers in the range, output them as space-separated values; otherwise, output "None". Each test case result should appear on a new line.

inputFormat

The first line of input contains a single integer T, the number of test cases. The following T lines each contain two space-separated integers A and B, denoting the start and end of the range respectively.

outputFormat

For each test case, output a single line. If there exists at least one prime palindromic number in the range \([A, B]\), output them in increasing order as space-separated values. Otherwise, print "None".

## sample
1
1 10
2 3 5 7

</p>