Problem: Dark  with his love for the prime numbers wanted to do some arithmetic so he decided to do some additions.
He wants to generate all prime numbers between two given numbers and add them up and decide whether that addition of numbers is a prime number or not?

Confused, Simply print "YES"(without quotes) if the sum of prime numbers between two numbers is a prime number and print "NO"(without quotes) if the sum of prime numbers between two numbers is a non-prime number.

Note:

If there are no prime numbers between two given numbers print "NO" (without quotes).

Input:

The first line contains T, the number of test cases.
Followed by T lines each contain two numbers M and N

Output:

For every test case print the YES if sum is a prime number else print NO.

If no prime number between M and N
then print NO.

Constraints

   1 ≤ T ≤ 10000
   1 ≤ M ≤ N ≤ 1000000

Note: 'M' & 'N'  are inclusive.

Author : Darshak Mehta

SAMPLE INPUT
3
1 9
14 37
1 6

SAMPLE OUTPUT
YES
NO
NO

Explanation

Test Case #1:
Prime numbers between 1 to 9 are 2,3,5,7 and their sum is 17 which is a prime number.

Test Case #3:
Prime numbers between 1 to 6 are 2,3,5 and their sum is 10 which is non-prime number

Solution (in PYTHON):

Solution:
p=[]

import math
import sys

sys.setrecursionlimit(4000)

def isprime(a):
      if(a<2):
            return False
      for i in xrange (2,int(math.pow(a,1.0/2)+1)):
            if(a%i)==0:
                  return False
      return True

def all_prime(a):
      n=[]
      for i in xrange(2,a+1):
            n.append(i)
      global p
      p=[]
      for i in n:
            if(i!=-1):
                  p.append(i)
                  for j in xrange (2*i-2,len(n),i):
                        n[j]=-1
def get_in():
      global I
      I=sys.stdin.readlines()
      global x
      x=len(I)-1
      m=0
      for i in xrange(0,x):
            a,b=I[i+1].split()
            if int(b)>m:
                  m=int(b)
      all_prime(m)
            
           
def process():
      global o
      o=""
      for i in xrange(0,x):
            s=0
            a,b=I[i+1].split()
            a=int(a)
            b=int(b)
            for g in xrange(0,len(p)):
                  if p[g]>b:
                        break
                  if(p[g]>=a and p[g]<=b):
                        s=s+p[g]
            
            if(isprime(s)):
                  o=o+("YES\n")
            else:
                  o=o+("NO\n")
                  
get_in()
process()
sys.stdout.write(o)