Given and , determine whether is prime. You must do this times.
Input Specification
The first line will contain the integer , the number of cases.
The next lines will each contain two integers, .
Output Specification
For each case, print YES
if is prime, and NO
otherwise on its own line.
Sample Input
4
6 5
16 13
61690850361 24777622630
34 33
Sample Output
YES
NO
NO
YES
Comments
This comment is hidden due to too much negative feedback. Show it anyway.
You don't even need BigInteger to solve it in Java.
Side note: Use python or ruby instead.