Under construction

Still being built. Things may change

Fantasy Pair

Time limit1sMemory limit256 MB

Summary
For each pair of string lengths A and B, decide whether their sum can be written as a sum of two primes.
Level

Medium4 of 10

Topics
Math, Number theory, Brute force, Implementation
Solved
No attempts yet

Problem

In Didiland, the land of fantasy, every resident carries one string as a token of fate. Whether two residents are a fantasy pair is decided in a very plain way. Join their two strings into one, and if that string can be cut exactly into two strings whose lengths are both prime, the two residents are a fantasy pair. Deciding whether such a cut exists is hard for them, so most of them walk past each other without ever knowing.

Write a program that decides whether two residents are a fantasy pair.

Assume that joining the strings and cutting them lose no length at all.

Input

The first line contains the number of test cases TT (1≤T≤5001 \le T \le 500).

Each of the next TT lines contains the lengths AA and BB of the two strings, separated by a space. (1≤A,B≤2×10121 \le A, B \le 2 \times 10^{12})

Output

Print one line per test case. Print YES if the joined string can be cut exactly into two strings of prime length, and NO otherwise.

Examples1

  1. Example 1

    Input
    2
    3 4
    3 5
    
    Expected output
    YES
    YES