#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define printv(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define X first
#define Y second
#define oset tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
const int mod = 998244353, x = 864197532, N = 8000, logN = 17;

struct trie {
	trie* ch[2];
	int sz;
	trie() {
		ch[0] = ch[1] = NULL;
		sz = 0;
	}
	void insert (int &v, int d = 29) {
		sz++;
		if (d < 0) return;
		bool f = v & (1 << d);
		if (!ch[f]) ch[f] = new trie();
		ch[f]->insert(v, d - 1);
	}
	void erase (int &v, int d = 29) {
		sz--;
		if (d < 0) return;
		bool f = v & (1 << d);
		ch[f]->erase(v, d - 1);
		if (sz == 0) delete this;
	}
	int query (int &v, int d = 29) {
		if (d < 0) return 0;
		bool f = v & (1 << d);
		if (ch[f] && sz > 0) return ch[f]->query(v, d - 1);
		return ch[!f]->query(v, d - 1) ^ (1 << d);
	}
	void release(int d = 29) {
		if (ch[0]) ch[0]->release(d - 1);
		if (ch[1]) ch[1]->release(d - 1);
		if (d < 29) delete this;
	}
};

vector <int> a;

lli get_ans(int l, int r, int bit) {
	if (l == r || bit < 0) return 0;
	int m;
	for (m = l; m < r && !(a[m] & (1 << bit)); ++m);
	lli ans = get_ans(l, m, bit - 1) + get_ans(m, r, bit - 1);
	trie* s = new trie();
	if (m != l && m != r) {
		fop (i,l,m) s->insert(a[i]);
		int tmp = 1 << 30;
		fop (i,m,r) {
			tmp = min(tmp, s->query(a[i]));
		}
		fop (i,l,m) s->erase(a[i]);
		ans += tmp;
	}
	return ans;
}

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    a.resize(n);
    fop (i,0,n) cin >> a[i];
    sort(all(a));
    cout << get_ans(0, n, 29) << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define printv(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define X first
#define Y second
#define oset tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
const int mod = 998244353, x = 864197532, N = 8000, logN = 17;

struct trie {
	trie* ch[2];
	int sz;
	trie() {
		ch[0] = ch[1] = NULL;
		sz = 0;
	}
	void insert (int &v, int d = 29) {
		sz++;
		if (d < 0) return;
		bool f = v & (1 << d);
		if (!ch[f]) ch[f] = new trie();
		ch[f]->insert(v, d - 1);
	}
	void erase (int &v, int d = 29) {
		sz--;
		if (d < 0) return;
		bool f = v & (1 << d);
		ch[f]->erase(v, d - 1);
		if (sz == 0) delete this;
	}
	int query (int &v, int d = 29) {
		if (d < 0) return 0;
		bool f = v & (1 << d);
		if (ch[f] && sz > 0) return ch[f]->query(v, d - 1);
		return ch[!f]->query(v, d - 1) ^ (1 << d);
	}
	void release(int d = 29) {
		if (ch[0]) ch[0]->release(d - 1);
		if (ch[1]) ch[1]->release(d - 1);
		if (d < 29) delete this;
	}
};

lli get_ans(vector <int> &a, int l, int r, int bit) {
	if (l == r || bit < 0) return 0;
	int m;
	for (m = l; m < r && !(a[m] & (1 << bit)); ++m);
	lli ans = get_ans(a, l, m, bit - 1) + get_ans(a, m, r, bit - 1);
	trie* s = new trie();
	if (m != l && m != r) {
		fop (i,l,m) s->insert(a[i]);
		int tmp = 1 << 30;
		fop (i,m,r) {
			tmp = min(tmp, s->query(a[i]));
		}
		fop (i,l,m) s->erase(a[i]);
		ans += tmp;
	}
	return ans;
}

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    fop (i,0,n) cin >> a[i];
    sort(all(a));
    cout << get_ans(a, 0, n, 29) << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define printv(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define X first
#define Y second
#define oset tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
const int mod = 998244353, x = 864197532, N = 8000, logN = 17;

struct trie {
	trie* ch[2];
	trie() {
		ch[0] = ch[1] = NULL;
	}
	void insert (int v, int d = 29) {
		if (d < 0) return;
		bool f = v & (1 << d);
		if (!ch[f]) ch[f] = new trie();
		ch[f]->insert(v, d - 1);
	}
	int query (int v, int d = 29) {
		if (d < 0) return 0;
		bool f = v & (1 << d);
		if (ch[f]) return ch[f]->query(v, d - 1);
		return ch[!f]->query(v, d - 1) ^ (1 << d);
	}
	void release(int d = 29) {
		if (ch[0]) ch[0]->release(d - 1);
		if (ch[1]) ch[1]->release(d - 1);
		if (d < 29) delete this;
	}
};

lli get_ans(vector <int> &a, int l, int r, int bit) {
	if (l == r || bit < 0) return 0;
	int m;
	for (m = l; m < r && !(a[m] & (1 << bit)); ++m);
	lli ans = get_ans(a, l, m, bit - 1) + get_ans(a, m, r, bit - 1);
	trie* s = new trie();
	if (m != l && m != r) {
		fop (i,l,m) s->insert(a[i]);
		int tmp = 1 << 30;
		fop (i,m,r) {
			tmp = min(tmp, s->query(a[i]));
		}
		ans += tmp;
		s->release();
	}
	return ans;
}

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    fop (i,0,n) cin >> a[i];
    sort(all(a));
    cout << get_ans(a, 0, n, 29) << endl;
}


from sys import stdin,stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math

def ai(): return list(map(int, stdin.readline().split()))
def ei(): return map(int, stdin.readline().split())
def ip(): return  int(stdin.readline().strip())
def op(ans): return stdout.write(str(ans) + '\n')

n,m=ei()
ls=ai()
ls.sort()
c=0
k=0
if 1 in ls or n in ls:
    print("no")
else:
    for i in range(len(ls)-1):
       #ls[i]-ls[i+1],ls[i],ls[i-1]
        if abs(ls[i]-ls[i+1])==1:
            c+=1
        else:
            c=0

        if c==2:
            print("no")
            k=1
            break
    if k==0:
        print("yes")


n,m=map(int,input().split())
arr=list(map(int,input().split()))
no=0
arr.sort()
if m<=2:
    print("YES")
    quit()
if arr[0]==1 or arr[-1]==n:
    print("NO")
    quit()
for i in range(2,m):
    if arr[i]-arr[i-1]==1 and arr[i-1]-arr[i-2]==1:
        no+=1
        break
if no==0:
    print("YES")
else:
    print("NO")


n,m=map(int,input().split())
arr=list(map(int,input().split()))
no=0
arr.sort()
if arr[0]==1 or arr[-1]==n:
    print("NO")
    quit()
if m<=2:
    print("YES")
    quit()
for i in range(2,m):
    if arr[i]-arr[i-1]==1 and arr[i-1]-arr[i-2]==1:
        no+=1
        break
if no==0:
    print("YES")
else:
    print("NO")


n,m=map(int,input().split())
arr=list(map(int,input().split()))
no=0
arr.sort()
if m==0:
    print("YES")
    quit()
elif m<=2 and (arr[0]!=1 or arr[-1]==n):
    print("YES")
if arr[0]==1 or arr[-1]==n:
    print("NO")
    quit()
for i in range(2,m):
    if arr[i]-arr[i-1]==1 and arr[i-1]-arr[i-2]==1:
        no+=1
        break
if no==0:
    print("YES")
else:
    print("NO")


n,m=map(int,input().split())
arr=list(map(int,input().split()))
no=0
arr.sort()
if arr[0]==1 or arr[-1]==n:
    print("NO")
    pass
if m<=2:
    print("YES")
    pass
for i in range(2,m):
    if arr[i]-arr[i-1]==1 and arr[i-1]-arr[i-2]==1:
        no+=1
        break
if no==0:
    print("YES")
else:
    print("NO")


n,m=map(int,input().split())
if m>0:
    arr=list(map(int,input().split()))
    no=0
    arr.sort()
if m==0:
    print("YES")
    quit()
elif m<=2 and (arr[0]!=1 and arr[-1]!=n):
    print("YES")
    quit()
if arr[0]==1 or arr[-1]==n:
    print("NO")
    quit()
for i in range(2,m):
    if arr[i]-arr[i-1]==1 and arr[i-1]-arr[i-2]==1:
        no+=1
        break
if no==0:
    print("YES")
else:
    print("NO")


n,m=map(int,input().split())
arr=list(map(int,input().split()))
no=0
arr.sort()
if m==0:
    print("YES")
    quit()
elif m<=2 and (arr[0]!=1 and arr[-1]!=n):
    print("YES")
    quit()
if arr[0]==1 or arr[-1]==n:
    print("NO")
    quit()
for i in range(2,m):
    if arr[i]-arr[i-1]==1 and arr[i-1]-arr[i-2]==1:
        no+=1
        break
if no==0:
    print("YES")
else:
    print("NO")


from sys import stdin,stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math

def ai(): return list(map(int, stdin.readline().split()))
def ei(): return map(int, stdin.readline().split())
def ip(): return  int(stdin.readline().strip())
def op(ans): return stdout.write(str(ans) + '\n')

n,m = ei()
if m==0:
	exit(print('YES'))
dirty = ai()
dirty.sort()
check = 0
if 1 in dirty or n in dirty:
	exit(print('NO'))
for i in range(m-1):
	if abs(dirty[i]-dirty[i+1]) == 1:
		check += 1
	else:
		check == 0
	if check == 2:
		break
if check == 2:
	print('NO')
else:
	print('YES')


from sys import stdin,stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math

def ai(): return list(map(int, stdin.readline().split()))
def ei(): return map(int, stdin.readline().split())
def ip(): return  int(stdin.readline().strip())
def op(ans): return stdout.write(str(ans) + '\n')

n,m = ei()
if m==0:
	exit(print('YES'))
dirty = ai()
dirty.sort()
check = 0
if 1 in dirty or n in dirty:
	exit(print('NO'))
for i in range(m-1):
	if abs(dirty[i]-dirty[i+1]) == 1:
		check += 1
	else:
		check = 0
	if check == 2:
		break
if check == 2:
	print('NO')
else:
	print('YES')


while True:
    try:
        def soln(n, k, a):
            a.sort()
            if a[0] == 1 or a[-1]==n:
                print("NO")
                return
            else:
                for i in range(2, k, 1):
                    if a[i] == a[i-1]+1 and a[i-1]== a[i-2]+1:
                        print("NO")
                        return
                print("YES")

        def read():
            n,k = map(int, input().split())
            if k > 0:
                a = list(map(int, input().split()))
            else:
                print("YES")
                return
            soln(n, k, a)

        if __name__ == "__main__":
            read()
    except EOFError:
        break


while True:
    try:
        def soln(n, k, a):
            a.sort()
            if a[0] == 1 or a[-1]==n:
                print("NO")
                return
            else:
                c = 1
                for i in range(k):
                    li = [c+1, c+2, c+3]
                    l= 0
                    t = 0
                    while i+l < k and l < 3:
                        if a[i+l] == li[l]:
                            t += 1
                        l += 1
                    if t == 3:
                        break
                    if (i+1) < k:
                        c = a[i+1]
                if t ==3:
                    print("NO")
                else:
                    print("YES")

        def read():
            n,k = map(int, input().split())
            if k > 0:
                a = list(map(int, input().split()))
            else:
                print("YES")
                return
            soln(n, k, a)

        if __name__ == "__main__":
            read()
    except EOFError:
        break


while True:
    try:
        def soln(n, k, a):
            a.sort()
            if a[0] == 1 or a[-1]==n:
                print("NO")
                return
            else:
                c = a[0]-1
                for i in range(k):
                    li = [c+1, c+2, c+3]
                    l= 0
                    t = 0
                    while i+l < k and l < 3:
                        if a[i+l] == li[l]:
                            t += 1
                        l += 1
                    if t == 3:
                        break
                    if (i+1) < k:
                        c = a[i+1]
                if t ==3:
                    print("NO")
                else:
                    print("YES")

        def read():
            n,k = map(int, input().split())
            if k > 0:
                a = list(map(int, input().split()))
            else:
                print("YES")
                return
            soln(n, k, a)

        if __name__ == "__main__":
            read()
    except EOFError:
        break


while True:
    try:
        def soln(n, k, a):
            a.sort()
            if a[0] == 1 or a[-1]==n:
                print("NO")
                return
            else:
                c = 1
                for i in range(k):
                    li = [c+1, c+2, c+3]
                    l= 0
                    t = 0
                    while i+l < k and l < 3:
                        if a[i+l] == li[l]:
                            t += 1
                        l += 1
                    if t == 3:
                        break
                    if (i+1) < k:
                        c = a[i+1]
                if t ==3:
                    print("NO")
                else:
                    print("YES")

        def read():
            n,k = map(int, input().split())
            a = list(map(int, input().split()))
            soln(n, k, a)

        if __name__ == "__main__":
            read()
    except EOFError:
        break


import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

def input(): return sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
n,k=map(int,input().split())
if k==0:
    print("YES")
    exit()

a=list(map(int,input().split()))
if k==1:
    if a[-1]==1:
        print("NO")
pos=0
f=0
a.sort()
if a[-1]==n:
    print("NO")
    exit()
for i in range(1,len(a)-1):
    if a[i]-a[i-1]==1 and a[i+1]-a[i]==1:
        print("NO")
        exit()
print("YES")


import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

def input(): return sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
n,k=map(int,input().split())
a=list(map(int,input().split()))
pos=0
f=0
a.sort()
if a[-1]==n:
    print("NO")
    exit()
for i in range(1,len(a)-1):
    if a[i]-a[i-1]==1 and a[i+1]-a[i]==1:
        print("NO")
        exit()
print("YES")


import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

def input(): return sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
n,k=map(int,input().split())
if k==0:
    print("YES")
    exit()

a=list(map(int,input().split()))
pos=0
f=0
a.sort()
if a[0]==1:
    print("NO")
    exit()
elif a[-1]==n:
    print("NO")
    exit()
else:
    for i in range(1,len(a)-1):
        if a[i]-a[i-1]==1 and a[i+1]-a[i]==1:
            print("NO")
            exit()
    print("YES")


import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

def input(): return sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
n,k=map(int,input().split())
if k==0:
    print("YES")
    exit()
a=list(map(int,input().split()))
pos=0
f=0
a.sort()
if a[-1]==n:
    print("NO")
    exit()
for i in range(1,len(a)-1):
    if a[i]-a[i-1]==1 and a[i+1]-a[i]==1:
        print("NO")
        exit()
print("YES")


import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

def input(): return sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
n,k=map(int,input().split())
if k==0:
    print("YES")
    exit()

a=list(map(int,input().split()))
if k==1:
    if a[-1]==1:
        print("NO")
        exit()
pos=0
f=0
a.sort()
if a[-1]==n:
    print("NO")
    exit()
for i in range(1,len(a)-1):
    if a[i]-a[i-1]==1 and a[i+1]-a[i]==1:
        print("NO")
        exit()
print("YES")


import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

def input(): return sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
n,k=map(int,input().split())
a=list(map(int,input().split()))
pos=0
f=0
a.sort()
for i in range(1,len(a)-1):
    if a[i]-a[i-1]==1 and a[i+1]-a[i]==1:
        print("NO")
        exit()
print("YES")


def arr_inp():
    return [int(x) for x in stdin.readline().split()]

def inp():
    return map(int, stdin.readline().split())

from sys import *

n, m = inp()
a, pre, move = sorted(arr_inp()), 1, 0
for i in a:
    if i - pre == 1:
        if i == n or move >= 2:
            exit(print('NO'))
        else:
            move += 1
    else:
        move = 0
    pre = i
print('YES')


def arr_inp():
    return [int(x) for x in stdin.readline().split()]

def inp():
    return map(int, stdin.readline().split())

from sys import *

n, m = inp()
a, pre, move = sorted(arr_inp()), 1, 0
# print(a)

if m > 0 and (a[0] == 1 or a[-1] == n):
    exit(print('NO'))

for i in a:
    if i - pre == 1:
        if move >= 1:
            exit(print('NO'))
        else:
            move += 1
    else:
        move = 0
    pre = i
print('YES')


def arr_inp():
    return [int(x) for x in stdin.readline().split()]

def inp():
    return map(int, stdin.readline().split())

from sys import *

n, m = inp()
a = sorted(arr_inp())
# print(a)

if m > 0 and (a[0] == 1 or a[-1] == n):
    exit(print('NO'))

pre, move = a[0], 0
for i in a[1:]:
    if i - pre == 1:
        if move >= 1:
            exit(print('NO'))
        else:
            move += 1
    else:
        move = 0
    pre = i
print('YES')


def arr_inp():
    return [int(x) for x in stdin.readline().split()]

def inp():
    return map(int, stdin.readline().split())

from sys import *

n, m = inp()
a, pre, move = sorted(arr_inp()), 1, 0
for i in a:
    if i - pre == 1:
        if move < 2:
            move += 1
        else:
            exit(print('NO'))
    else:
        move = 0
    pre = i
print('YES')


def arr_inp():
    return [int(x) for x in stdin.readline().split()]

def inp():
    return map(int, stdin.readline().split())

from sys import *

n, m = inp()
a, pre, move = sorted(arr_inp()), 1, 0

if m > 0 and (a[0] == 1 or a[-1] == n):
    exit(print('NO'))

for i in a:
    if i - pre == 1:
        if move >= 2:
            exit(print('NO'))
        else:
            move += 1
    else:
        move = 0
    pre = i
print('YES')


def arr_inp():
    return [int(x) for x in stdin.readline().split()]

def inp():
    return map(int, stdin.readline().split())

from sys import *

n, m = inp()
a, pre, move = sorted(arr_inp()), 1, 0
if a[0] == 1 or a[-1] == n:
    exit(print('NO'))

for i in a:
    if i - pre == 1:
        if i == n or move >= 2:
            exit(print('NO'))
        else:
            move += 1
    else:
        move = 0
    pre = i
print('YES')


def arr_inp():
    return [int(x) for x in stdin.readline().split()]

def inp():
    return map(int, stdin.readline().split())

from sys import *

n, m = inp()
a = sorted(arr_inp())
# print(a)
if m == 0:
    exit(print('YES'))

if a[0] == 1 or a[-1] == n:
    exit(print('NO'))

pre, move = a[0], 0
for i in a[1:]:
    if i - pre == 1:
        if move >= 1:
            exit(print('NO'))
        else:
            move += 1
    else:
        move = 0
    pre = i
print('YES')


import sys

inf = float("inf")
# sys.setrecursionlimit(10000000)

# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod, MOD = 1000000007, 998244353
# vow=['a','e','i','o','u']
# dx,dy=[-1,1,0,0],[0,0,1,-1]

# import random
# from collections import deque, Counter, OrderedDict,defaultdict
# from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
# from math import ceil,floor,log,sqrt,factorial
# from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right

def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

n,m = get_ints()
Arr = get_array()
Arr.sort()
if Arr[0]==1 or Arr[-1]==n:
    print('NO')
    exit()
flag = 0
for i in range(len(Arr)-2):
    if Arr[i+1]==Arr[i]+1 and Arr[i+2]==Arr[i]+2:
        flag = 1
        break
if flag==0:
    print('YES')
else:
    print('NO')


import sys

inf = float("inf")
# sys.setrecursionlimit(10000000)

# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod, MOD = 1000000007, 998244353
# vow=['a','e','i','o','u']
# dx,dy=[-1,1,0,0],[0,0,1,-1]

# import random
from collections import deque, Counter, OrderedDict,defaultdict
# from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
# from math import ceil,floor,log,sqrt,factorial
# from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right

def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

n,m = get_ints()
if m==0:
    print('YES')
    exit()
Arr = get_array()
Arr.sort()
if Arr[0]==1 or Arr[-1]==n:
    print('NO')
    exit()
flag = 0
for i in range(len(Arr)-2):
    if Arr[i+1]==Arr[i]+1 and Arr[i+2]==Arr[i]+2:
        flag = 1
        break
if flag==0:
    print('YES')
else:
    print('NO')


n,m=map(int,input().split())
if(m==0):
    print("YES")
    exit(0)
a=list(map(int,input().strip().split()))
if(1 in a) or(n in a):
    print("NO")
elif m==0:
    print("YES")
else:
    a.sort()
    c=1
    f=1
    for i in range(m-1):
        if (a[i+1]-a[i])==1:
            c+=1
            if c>2:
                f=0
                break
        else:
            c=1

    if(f==1):
        print("YES")
    else:
        print("NO")


n,m=map(int,input().split())
if(m!=0):
    a=list(map(int,input().strip().split()))
if(1 in a) or(n in a):
    print("NO")
elif m==0:
    print("YES")
else:
    a.sort()
    c=1
    f=1
    for i in range(m-1):
        if (a[i+1]-a[i])==1:
            c+=1
            if c>2:
                f=0
                break
        else:
            c=1

    if(f==1):
        print("YES")
    else:
        print("NO")


n,m=map(int,input().split())
a=list(map(int,input().strip().split()))
if(1 in a) or(n in a):
    print("NO")
else:
    a.sort()
    c=1
    f=1
    for i in range(m-1):
        if (a[i+1]-a[i])==1:
            c+=1
            if c>2:
                f=0
                break
        else:
            c=1

    if(f==1):
        print("YES")
    else:
        print("NO")


n,m=map(int,input().split())
a=list(map(int,input().strip().split()))
if(1 in a) or(n in a):
    print("NO")
elif m==0:
    print("YES")
else:
    a.sort()
    c=1
    f=1
    for i in range(m-1):
        if (a[i+1]-a[i])==1:
            c+=1
            if c>2:
                f=0
                break
        else:
            c=1

    if(f==1):
        print("YES")
    else:
        print("NO")


"""
    Template written to be used by Python Programmers.
    Use at your own risk!!!!
    Owned by adi0311(rating - 1989 at CodeChef and 1449 at Codeforces).
"""
import sys
import bisect
import heapq
from math import *
from collections import defaultdict as dd  # defaultdict(<datatype>) Free of KeyError.
from collections import deque  # deque(list) append(), appendleft(), pop(), popleft() - O(1)
from collections import Counter as c  # Counter(list)  return a dict with {key: count}
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
# sys.setrecursionlimit(2*pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var): sys.stdout.write(var)
def l(): return list(map(int, data().split()))
def sl(): return list(map(str, data().split()))
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [[val for i in range(n)] for j in range(m)]

n, m = sp()
arr = l()
arr.sort()
if 1 in arr or n in arr:
    out("NO")
    exit()
for i in range(len(arr)-2):
    a, b = arr[i+2]-arr[i+1], arr[i+1]-arr[i]
    if a == 1 and b == 1:
        out("NO")
        exit()
out("YES")


"""
    Template written to be used by Python Programmers.
    Use at your own risk!!!!
    Owned by adi0311(rating - 1989 at CodeChef and 1449 at Codeforces).
"""
import sys
import bisect
import heapq
from math import *
from collections import defaultdict as dd  # defaultdict(<datatype>) Free of KeyError.
from collections import deque  # deque(list) append(), appendleft(), pop(), popleft() - O(1)
from collections import Counter as c  # Counter(list)  return a dict with {key: count}
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
# sys.setrecursionlimit(2*pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var): sys.stdout.write(var)
def l(): return list(map(int, data().split()))
def sl(): return list(map(str, data().split()))
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [[val for i in range(n)] for j in range(m)]

n, m = sp()
arr = l()
arr.sort()
if 1 in arr or n in arr:
    out("NO")
    exit()
for i in range(len(arr)-3):
    a, b = arr[i+2]-arr[i+1], arr[i+1]-arr[i]
    if a == 1 and b == 1:
        out("NO")
        exit()
out("YES")


n,k=map(int,input().split())
if(k>0):
    l=list(map(int,input().split()))
    l.sort()
c=0
if(k==0):
    print("YES")
elif(l[0]==1 or l[-1]==n):
    print("NO")
elif(k==2):
    if(l[1]-l[0]==1):
        print('NO')
    else:
        print("YES")
else:
    for i in range(k-2):
        if (l[i+1]-l[i]==1 and l[i+2]-l[i+1]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
c=0
if(k==2):
    if(l[1]-l[0]==1):
        print('NO')
    else:
        print("YES")
else:
    for i in range(k-2):
        if (l[i+1]-l[i]==1 and l[i+2]-l[i+1]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,k=map(int,input().split())
if(k>0):
    l=list(map(int,input().split()))
    l.sort()
c=0
if(k==0):
    print("YES")
elif(k==2):
    if(l[1]-l[0]==1):
        print('NO')
    else:
        print("YES")
else:
    for i in range(k-2):
        if (l[i+1]-l[i]==1 and l[i+2]-l[i+1]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
c=0
for i in range(k-2):
    if (l[i+1]-l[i]==1 and l[i+2]-l[i+1]==1):
        c=1
        break
if(c==0):
    print("YES")
else:
    print('NO')


n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
c=0
if(k==0):
    print("YES")
elif(k==2):
    if(l[1]-l[0]==1):
        print('NO')
    else:
        print("YES")
else:
    for i in range(k-2):
        if (l[i+1]-l[i]==1 and l[i+2]-l[i+1]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,k=map(int,input().split())
if(k>0):
    l=list(map(int,input().split()))
    l.sort()
c=0
if(k==0):
    print("YES")
elif(l[0]==1 or l[-1]==n):
    print("NO")
else:
    for i in range(2,k):
        if (l[i]-l[i-1]==1 and l[i-1]-l[i-2]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
c=0
if(n==2):
    if(l[1]-l[0]==1):
        print('NO')
    else:
        print("YES")
else:
    for i in range(k-2):
        if (l[i+1]-l[i]==1 and l[i+2]-l[i+1]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,k=map(int,input().split())
if(k>0):
    l=list(map(int,input().split()))
    l.sort()
c=0
if(k==0):
    print("YES")
elif(l[0]==1 or l[-1]==n):
    print("YES")
elif(k==2):
    if(l[1]-l[0]==1):
        print('NO')
    else:
        print("YES")
else:
    for i in range(k-2):
        if (l[i+1]-l[i]==1 and l[i+2]-l[i+1]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,k=map(int,input().split())
if(k>0):
    l=list(map(int,input().split()))
    l.sort()
c=0
if(k==0):
    print("YES")
elif(l[0]==1):
    print("NO")
elif(k==2):
    if(l[1]-l[0]==1):
        print('NO')
    else:
        print("YES")
else:
    for i in range(k-2):
        if (l[i+1]-l[i]==1 and l[i+2]-l[i+1]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,k=map(int,input().split())
if(k>0):
    l=list(map(int,input().split()))
    l.sort()
c=0
if(k==0):
    print("YES")
elif(l[0]==1):
    print("NO")
elif(k==2):
    if(l[1]-l[0]==1):
        print('NO')
    else:
        print("YES")
else:
    for i in range(k-1):
        if (l[i+1]-l[i]==1):
            c=1
            break
    if(c==0):
        print("YES")
    else:
        print('NO')


n,m = map(int,input().split())
s = sorted([int(i) for i in input().split()])
cnt = 0
a = 0

for i in range(m-1):
	if s[i+1]-s[i]==1:
		cnt+=1
	else:
		cnt = 0
	a = max(a,cnt+1)

if a>2 or s[-1]==n:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
s = set([int(i) for i in input().split()])
d = [i for i in range(1,n+2)]
r = []
a = 0
for i in range(n+1):
	if d[i] not in s:
		r.append(d[i])

for i in range(len(r)-1):
	a = max(r[i+1]-r[i],a)

if a>3:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
s = set([int(i) for i in input().split()])
d = [i for i in range(1,n+1)]
a = 0
r = []
for i in range(n):
	if d[i] not in s:
		r.append(d[i])
for i in range(len(r)-1):
	a = max(r[i+1]-r[i],a)

if a>2:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
s = sorted([int(i) for i in input().split()])
cnt = 0
a = 0
if m==0:
	print("YES")
else:

	for i in range(m-1):
		if s[i+1]-s[i]==1:
			cnt+=1
		else:
			cnt = 0
		a = max(a,cnt+1)

	if a>2 or s[-1]==n:
		print("NO")
	else:
		print("YES")


n,m = map(int,input().split())
if m==0:
	print("YES")

else:
	s = sorted([int(i) for i in input().split()])
	cnt = 0
	a = 0

	for i in range(m-1):
		if s[i+1]-s[i]==1:
			cnt+=1
		else:
			cnt = 0
		a = max(a,cnt+1)

	if a>2 or s[-1]==n or s[0]==1:
		print("NO")
	else:
		print("YES")


n,m = map(int,input().split())
s = sorted([int(i) for i in input().split()])
cnt = 0
a = 0
for i in range(m-1):
	if s[i+1]-s[i]==1:
		cnt+=1
	else:
		cnt = 0
	a = max(a,cnt+1)

if a>2:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
s = set([int(i) for i in input().split()])
d = [i for i in range(1,n+2)]
r = []
a = 0
for i in range(n+1):
	if d[i] not in s:
		r.append(d[i])

for i in range(len(r)-1):
	a = max(r[i+1]-r[i],a)

if a>3 or n in s:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
s = set([int(i) for i in input().split()])
d = [i for i in range(1,n+1)]
a = 0
r = []

for i in range(n):
	if d[i] not in s:
		r.append(d[i])
for i in range(len(r)-1):
	a = max(a,r[i+1]-r[i])

if a>3 or max(s)==n:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
if m==0:
	print("YES")

else:
	s = sorted([int(i) for i in input().split()])
	cnt = 0
	a = 0

	for i in range(m-1):
		if s[i+1]-s[i]==1:
			cnt+=1
		else:
			cnt = 0
		a = max(a,cnt+1)

	if a>2 or s[-1]==n:
		print("NO")
	else:
		print("YES")


n,m = map(int,input().split())
s = set([int(i) for i in input().split()])
d = [i for i in range(1,n+1)]
r = []
a = 0
for i in range(n):
	if d[i] not in s:
		r.append(d[i])

for i in range(len(r)-1):
	a = max(r[i+1]-r[i],a)

if a>3:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
s = sorted([int(i) for i in input().split()])
cnt = 0
a = s[0]-1
for i in range(m-1):
	if s[i+1]-s[i]==1:
		cnt+=1
	else:
		cnt = 0
	a = max(a,cnt+1)

if a>2:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
s = sorted([int(i) for i in input().split()])
cnt = 0
a = 0
if m==0:
	print("YES")
else:

	for i in range(m-1):
		if s[i+1]-s[i]==1:
			cnt+=1
		else:
			cnt = 0
		a = max(a,cnt+1)

	if a<=2 and s[-1]==n:
		print("NO")
	else:
		print("YES")


n,m = map(int,input().split())
s = set([int(i) for i in input().split()])
d = [i for i in range(1,n+1)]
a = 0
r = []
for i in range(n):
	if d[i] not in s:
		r.append(d[i])
for i in range(len(r)-1):
	a = max(r[i+1]-r[i],a)

if a>3:
	print("NO")
else:
	print("YES")


n,m = map(int,input().split())
s = set([int(i) for i in input().split()])
d = [i for i in range(1,n+1)]
a = 0
r = []
for i in range(n):
	if d[i] not in s:
		r.append(d[i])
for i in range(len(r)-1):
	a = max(r[i+1]-r[i],a)

if a<3:
	print("NO")
else:
	print("YES")


[n,m]=[int(x) for x in input().split()]

dirty=[0]*3001

for x in input().split():

	dirty[int(x)]+=1
flag=False
if dirty[1]==1 or dirty[n]==1:
	print('NO')
	flag=True

if flag!=True:
	stair=1
	while True:
		if stair>=n:
			print('YES')
			break
		if dirty[stair+3]==1 and dirty[stair+2]==1 and dirty[stair+1]==1:
			print('NO')
			break
		if dirty[stair+3]!=1:
			stair+=3
			continue
		if dirty[stair+2]!=1:
			stair+=2
			continue
		if dirty[stair+1]!=1:
			stair+=1


R = lambda: map(int, input().split())
n, m = R()
d = sorted(R()) if m > 0 else []
print("YES" if len(d) == 0 or d[0] != 1 and d[m - 1] != n and all(d[i + 2] - d[i] > 2 for i in range(m - 2)) else "NO")


[n,m]=[int(x) for x in input().split()]

dirty=[0]*3001

for x in input().split():

	dirty[int(x)]+=1

if dirty[1]==1 or dirty[n]==1:
	print('NO')
	exit()

stair=1
while True:
	if stair>=n:
		print('YES')
		break
	if dirty[stair+3]==1 and dirty[stair+2]==1 and dirty[stair+1]==1:
		print('NO')
		break
	if dirty[stair+3]!=1:
		stair+=3
		continue
	if dirty[stair+2]!=1:
		stair+=2
		continue
	if dirty[stair+1]!=1:
		stair+=1


n,m= map(int,input().split())
if m!=0:
    a=[int(x) for x in input().split()]
    a.sort()
    an=0
    if 1 in a or n in a:
        an=-1
    for i in range(m-2):
        if a[i+1]==a[i]+1 and a[i+2]==a[i]+2:
            an=-1
            break
    if an==0:
        print("YES")
    else:
        print("NO")
else:
    print("YES")


n,m= map(int,input().split())
a=[int(x) for x in input().split()]
a.sort()
an=0
if 1 in a or n in a:
    an=-1
for i in range(m-3):
    if a[i+1]==a[i]+1 and a[i+2]==a[i]+2:
        an=-1
        break
if an==0:
    print("YES")
else:
    print("NO")


n,m= map(int,input().split())
if m!=0:
    a=[int(x) for x in input().split()]
    a.sort()
    an=0
    if 1 in a or n in a:
        an=-1
    for i in range(m-3):
        if a[i+1]==a[i]+1 and a[i+2]==a[i]+2:
            an=-1
            break
    if an==0:
        print("YES")
    else:
        print("NO")
else:
    print("YES")


n,m= map(int,input().split())
a=[int(x) for x in input().split()]
a.sort()
an=0
if 1 in a or n in a:
    an=-1
for i in range(m-2):
    if a[i+1]=a[i]+1 and a[i+2]=a[i]+2:
        an=-1
        break
if an==0:
    print("YES")
else:
    print("NO")


n,m= map(int,input().split())
a=[int(x) for x in input().split()]
a.sort()
an=0
if 1 in a or n in a:
    an=-1
for i in range(m-2):
    if a[i+1]==a[i]+1 and a[i+2]==a[i]+2:
        an=-1
        break
if an==0:
    print("YES")
else:
    print("NO")


def main():
    n,k = map(int,input().split())
    d = sorted(list(map(int,input().split())))
    a = [0]*(n+1)
    for i in d:
        a[i] = 1
    if a[1]or a[n]:
        print("NO")

    else:
        i = 1
        while i < n:
            if a[i+1] and (i+2 < n and a[i+2]) and  (i+3 < n  and a[i+3]):
                print("NO")

                return
            else:
                if a[i+1] == 0:
                    i += 1
                elif i+2 <= n and a[i+2]== 0:
                    i += 2
                elif i+3 <= n and a[i+3] == 0:
                    i += 3
        print("YES")
if __name__ == '__main__':
    main()


def main():
    n,k = map(int,input().split())
    d = sorted(map(int,input().split()))

    if 1 in d or n in d:
        print("NO")
    else:
        for i in range(k-2):
            if d[i+2] == d[i]+2 and d[i+1] == d[i]+1:
                print("NO")
                return

        print("YES")
if __name__ == '__main__':
    main()


def main():
    n,k = map(int,input().split())
    if k > 0:
        d = sorted(map(int,input().split()))

        if 1 in d or n in d:
            print("NO")
        else:
            for i in range(k-2):
                if d[i+2] == d[i]+2 and d[i+1] == d[i]+1:
                    print("NO")
                    return

    print("YES")
if __name__ == '__main__':
    main()


def main():
    n,k = map(int,input().split())
    if k > 0:
        d = sorted(map(int,input().split()))

        if 1 in d or n in d:
            print("NO")
            return
        else:
            for i in range(k-2):
                if d[i+2] == d[i]+2 and d[i+1] == d[i]+1:
                    print("NO")
                    return

    print("YES")
if __name__ == '__main__':
    main()


def main():
    n,k = map(int,input().split())
    d = set(map(int,input().split()))

    if 1 in d or n in d:
        print("NO")
    else:
        i = 1
        while i < n:
            if i+1 in d and (i+2 < n and 1+2 in d) and (i+3 and i+3 in d):
                print("NO")
                return
            else:
                if i+1 not in d:
                    i += 1
                elif i+2 <= n and i+2 not in d:
                    i += 2
                else:
                    i += 3
        print("YES")
if __name__ == '__main__':
    main()


from sys import stdin,stdout
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

n, m = iia()
arr = set(iia())
i = 1
while i<n+1:
    if (i == 1 or i == n) and i in arr:
        print("NO")
        break
    else:
        if i in arr:
            if i + 1 in arr or i+1>n:
                if i + 2 in arr or i+2>n:
                    print("NO")
                    break
                else:
                    i += 3
            else:
                i += 2
        else:
            i += 1
else:
    print("YES")


from sys import stdin,stdout
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

n, m = iia()
arr = set(iia())
i = 1
while i<n+1:
    if (i == 1 or i == n) and i in arr:
        print("NO")
    else:
        if i in arr:
            if i + 1 in arr:
                if i + 2 in arr:
                    print("NO")
                    break
                else:
                    i += 3
            else:
                i += 2
        else:
            i += 1
else:
    print("YES")


from sys import stdin,stdout
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

n, m = iia()
arr = sorted(iia())
if arr[0] == 1 or arr[-1] == n:
    print("NO")
else:
    for i in range(1, m):
        if arr[i] - arr[i - 1] == 1:
            if i + 1 < m and arr[i + 1] - arr[i - 1] == 1:
                print("NO")
                break
    else:
        print("YES")


from sys import stdin,stdout
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

n, m = iia()
arr = sorted(iia())
if len(arr) and (arr[0] == 1 or arr[-1] == n):
    print("NO")
else:
    for i in range(1, m):
        if arr[i] - arr[i - 1] == 1:
            if i + 1 < m and arr[i + 1] - arr[i] == 1:
                print("NO")
                break
    else:
        print("YES")


from sys import stdin,stdout
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

n, m = iia()
arr = sorted(iia())
i = 0
while i < m:
    if arr[i] == 1 or arr[i] == n:
        print("NO")
        break
    else:
        if i + 1 < m and (arr[i + 1] - arr[i] <= 1 or arr[i + 1] > n):
            if i + 2 < m and (arr[i + 2] - arr[i-1] <= 1 or arr[i + 2] > n):
                print("NO")
                break
    i += 1
else:
    print("YES")


from sys import stdin,stdout
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

n, m = iia()
arr = sorted(iia())
if arr[0] == 1 or arr[-1] == n:
    print("NO")
else:
    for i in range(1, m):
        if arr[i] - arr[i - 1] == 1:
            if i + 1 < m and arr[i + 1] - arr[i] == 1:
                print("NO")
                break
    else:
        print("YES")


n, m = map(int, input().split())
d = list(map(int, input().split()))
d.sort()
a = []
found = False
for i in range(1, m):
    a.append(d[i]-d[i-1])
for i in range(1, m-1):
    if a[i]==1:
        if a[i-1]==1:
            found = True
            break
if found:
    print('NO')
else:
    print('YES')


n, m = map(int, input().split())
d = list(map(int, input().split()))
if n in d:
    print('NO')
else:
    d.sort()
    a = []
    found = False
    for i in range(1, m):
        a.append(d[i]-d[i-1])
    for i in range(1, m-1):
        if a[i] == 1:
            if a[i-1] == 1:
                found = True
                break
    if found:
        print('NO')
    else:
        print('YES')


n, m = map(int, input().split())
d = None
if m>0:
    d = list(map(int, input().split()))
    if (n in d) or (1 in d):
        print('NO')
    elif m<=2:
        print("YES")
    else:
        d.sort()
        a = []
        found = False
        for i in range(1, m):
            a.append(d[i]-d[i-1])
        for i in range(1, m-1):
            if a[i] == 1:
                if a[i-1] == 1:
                    found = True
                    break
        if found:
            print('NO')
        else:
            print('YES')
else:
    print("YES")


n, m = map(int, input().split())
d = list(map(int, input().split()))
if n in d:
    print('NO')
elif m<=2:
    print("YES")
else:
    d.sort()
    a = []
    found = False
    for i in range(1, m):
        a.append(d[i]-d[i-1])
    for i in range(1, m-1):
        if a[i] == 1:
            if a[i-1] == 1:
                found = True
                break
    if found:
        print('NO')
    else:
        print('YES')


n, m = map(int,input().split())
if m == 0: print("YES"); exit(0)
arr = [int(i) for i in input().split()]
arr.sort()
x=1
i=0
if n in arr: print("NO"); exit(0)
while(i<len(arr)-1) and x < 3:
    if arr[i+1] - arr[i] == 1: x+=1
    else: x=1
    i+=1
if x>=3: print("NO")
else: print("YES")


n, m = map(int,input().split())
if m == 0: print("YES"); exit(0)
arr = [int(i) for i in input().split()]
arr.sort()
i=0
if n in arr or m==1: print("NO"); exit(0)
while(i<len(arr)-2):
    if arr[i+2]-arr[i] == 2: print("NO"); exit(0)
    i+=1
print("YES")


n, m = map(int,input().split())
arr = [int(i) for i in input().split()]
arr.sort()
x=1
i=0
if n in arr: print("NO"); exit(0)
if n == 0: print("YES"); exit(0)
while(i<len(arr)-1) and x < 3:
    if arr[i+1] - arr[i] == 1: x+=1
    else: x=1
    i+=1
if x>=3: print("NO")
else: print("YES")


n, m = map(int,input().split())
if m == 0: print("YES"); exit(0)
arr = [int(i) for i in input().split()]
arr.sort()
i=0
if n in arr or 1 in arr: print("NO"); exit(0)
while(i<len(arr)-2):
    if arr[i+2]-arr[i] == 2: print("NO"); exit(0)
    i+=1
print("YES")


n, m = map(int,input().split())
if m == 0: print("YES"); exit(0)
arr = [int(i) for i in input().split()]
arr.sort()
i=0
if n in arr: print("NO"); exit(0)
while(i<len(arr)-2):
    if arr[i+2]-arr[i] == 2: print("NO"); exit(0)
    i+=1
print("YES")


n, m = map(int,input().split())
arr = [int(i) for i in input().split()]
arr.sort()
x=1
i=0
while(i<len(arr)-1) and x < 3:
    if arr[i+1] - arr[i] == 1: x+=1
    else: x=1
    i+=1
if x>=3: print("NO")
else: print("YES")


n, m = map(int,input().split())
if n == 0: print("YES"); exit(0)
arr = [int(i) for i in input().split()]
arr.sort()
x=1
i=0
if n in arr: print("NO"); exit(0)
while(i<len(arr)-1) and x < 3:
    if arr[i+1] - arr[i] == 1: x+=1
    else: x=1
    i+=1
if x>=3: print("NO")
else: print("YES")


n, m = map(int,input().split())
arr = [int(i) for i in input().split()]
arr.sort()
x=1
i=0
if n in arr: print("NO"); exit(0)
while(i<len(arr)-1) and x < 3:
    if arr[i+1] - arr[i] == 1: x+=1
    else: x=1
    i+=1
if x>=3: print("NO")
else: print("YES")


n, m = map(int,input().split())
arr = [int(i) for i in input().split()]
arr.sort()
x=0
i=0
while(i<len(arr)-1) and x < 3:
    if arr[i+1] - arr[i] == 1: x+=1
    else: x=0
    i+=1
if x>=3: print("NO")
else: print("YES")


k,n=map(int,input().split())
l=[int(i) for i in input().split()]
#l is dirty
from collections import Counter
c=Counter(l)
l.sort()
for i in range(2,n):
    if l[i]==l[i-1]+1 and l[i-1]==l[i-2]+1:
        print('NO')
        exit()
if c[k]:
    print('NO')
    exit()
print('YES')


k,n=map(int,input().split())
l=[int(i) for i in input().split()]
#l is dirty
from collections import Counter
c=Counter(l)
l.sort()
for i in range(2,n):
    if l[i]==l[i-1]+1 and l[i-1]==l[i-2]+1:
        print('NO')
        exit()
print('YES')


k,n=map(int,input().split())
if n==0:
    print('YES')
    exit()
l=[int(i) for i in input().split()]
#l is dirty
from collections import Counter
c=Counter(l)
l.sort()
for i in range(2,n):
    if l[i]==l[i-1]+1 and l[i-1]==l[i-2]+1:
        print('NO')
        exit()
if c[k] or c[1]:
    print('NO')
    exit()
print('YES')


k,n=map(int,input().split())
if n==0:
    print('YES')
    exit()
l=[int(i) for i in input().split()]
#l is dirty
from collections import Counter
c=Counter(l)
l.sort()
for i in range(2,n):
    if l[i]==l[i-1]+1 and l[i-1]==l[i-2]+1:
        print('NO')
        exit()
if c[k]:
    print('NO')
    exit()
print('YES')


n=tuple(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
if a[0]==1 or a[-1]==n[0]:
    print("NO")
else:
    c=True
    for i in range ( n [ 1]-2):
        if a[i]==a[i+1]-1 and a[i+1]==a[i+2]-1:
            print("NO")
            c=False
            break
try:
    if c:
        print("Yes")
except:
    pass


n=tuple(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
c=True
if n[1]==0:
    print("YES")
    c=False
elif a[0]==1 or a[-1]==n[0]:
    print("NO")
    c=False
else:
    for i in range ( n [ 1]-2):
        if a[i]==a[i+1]-1 and a[i+1]==a[i+2]-1:
            print("NO")
            c=False
            break
if c:
        print("YES")


n=tuple(map(int,input().split()))
if n[1]:
    a=list(map(int,input().split()))
    a.sort()
c=True
if n[1]==0:
    print("YES")
    c=False
elif a[0]==1 or a[-1]==n[0]:
    print("NO")
    c=False
else:
    for i in range ( n [ 1]-2):
        if a[i]==a[i+1]-1 and a[i+1]==a[i+2]-1:
            print("NO")
            c=False
            break
if c:
        print("YES")


n=tuple(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
if a[0]==1 or a[-1]==n[0]:
    print("NO")
else:
    c=True
    for i in range ( n [ 1]-2):
        if a[i]==a[i+1]-1 and a[i+1]==a[i+2]-1:
            print("NO")
            c=False
            break
try:
    if c:
        print("YES")
except:
    pass


n, m = map(int, input().split())
if m!=0:
    d = [int(x) for x in input().split()]
    d.sort()
    new = []
    for i in range(1, m):
        new.append(d[i]-d[i-1]-1)
    count = 0
    maxi = 0
    if d[m-1]==n:
        print("NO")
    else:
        for i in range(m-1):
            if new[i]==0:
                count += 1
            else:
                maxi = max(maxi, count)
                count = 0
        maxi = max(maxi, count)
        if maxi>1:
            print("NO")
        else:
            print("YES")
else:
    print("YES")


n, m = map(int, input().split())
if m!=0:
    d = [int(x) for x in input().split()]
    d.sort()
    new = []
    for i in range(1, m):
        new.append(d[i]-d[i-1]-1)
    count = 0
    maxi = 0
    if d[m-1]==n or d[0]==1:
        print("NO")
    else:
        for i in range(m-1):
            if new[i]==0:
                count += 1
            else:
                maxi = max(maxi, count)
                count = 0
        maxi = max(maxi, count)
        if maxi>1:
            print("NO")
        else:
            print("YES")
else:
    print("YES")


 #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
long long x,y;
cin>>t;
for(int i=0;i<t;i++)
{cin>>x>>y;
long long z=x-y;
if(z>1)
cout<<"YES";
else
cout<<"N0";
}}


 #include<bits/stdc++.h>
using namespace std;
int main(){
int t,x,y;
cin>>t;
for(int i=0;i<t;i++)
{cin>>x>>y;
int z=x-y;
if(z>1)
cout<<"YES";
else
cout<<"N0";
}}


 #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
long long x,y;
cin>>t;
for(int i=0;i<t;i++)
{cin>>x>>y;
long long z=x-y;
if(z>1)
cout<<"YES"<<"\n";
else
cout<<"N0"<<"\n";
}}


 #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
long long x,y;
cin>>t;
for(int i=0;i<t;i++)
{cin>>x>>y;
long long z=x-y;
if(z>1)
cout<<"YES"<<"\n";
else
cout<<"NO"<<"\n";
}}


 #include<bits/stdc++.h>
using namespace std;
int main(){
int t,x,y;
cin>>t;
for(int i=0;i<t;i++)
{cin>>x>>y;
int z=x-y;
if(z>1)
cout<<"YES"<<"\n";
else
cout<<"N0"<<"\n";
}}


#include <bits/stdc++.h>

using namespace std;
using suhaib = long long;

int main(){

suhaib x , y , t , number (0) , prime [8] = {2,3,5,7,11,13,17,19} , o (0);
cin >> t;
while (t--){
cin >> x >> y;
number = x - y;

for (suhaib i = 0 ; i <= 8 ; ++i){
if (i == 8){
    cout << "NO" << endl;
}
else if (number % prime [i] == 0){
    cout << "YES" << endl;
    ++o;
    break;
}
}
}

return 0;
}


#include <bits/stdc++.h>

using namespace std;
using suhaib = long long;

int main(){

suhaib x , y , t ;
while (t--){
cin >> x >> y;

if ( (x-y) == 1){
cout << "NO";
}
else {
    cout << "NO";
}
}

return 0;
}


#include <bits/stdc++.h>

using namespace std;
using suhaib = long long;

int main(){

suhaib x , y , t , n;
cin >> t;
while (t--){
cin >> x >> y;
n = x - y;
if ( n == 1){
    cout << "NO" << endl;
}
else {
    cout << "YES" << endl;
}
}

return 0;
}


#include <bits/stdc++.h>

using namespace std;
using suhaib = long long;

int main(){

suhaib x , y , t ;
cin >> t;
while (t--){
cin >> x >> y;

if ( (x-y) == 1){
cout << "NO";
}
else {
    cout << "NO";
}
}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{

int n;
cin>>n;
for(int k=0; k<n; k++){

	long long a,b;

	cin>>a>>b;

	int m=a-b;
if(m==1){
	cout<<"NO"<<endl;

}else{
	cout<<"YES"<<endl;
}

}

}


#include<bits/stdc++.h>
using namespace std;
int main()
{

long long n;
cin>>n;
for(int k=0; k<n; k++){

	long long a,b;

	cin>>a>>b;

	long long m=a-b;
if(m==1){
	cout<<"NO"<<endl;

}else{
	cout<<"YES"<<endl;
}

}

}


#include<bits/stdc++.h>
using namespace std;
int main()
{

int n;
cin>>n;
for(int k=0; k<n; k++){

	int a,b;

	cin>>a>>b;

	int m=a-b;
if(m==1){
	cout<<"NO"<<endl;

}else{
	cout<<"YES"<<endl;
}

}

}


#include<btis/stdc++.h>
using namespace std;
int main()
{

int n;
for(int k=0; k<n; k++){

	int a,b;

	cin>>a>>b;

	int m=a-b;
if(m==1){
	cout<<"NO";

}else{
	cout<<"YES";
}

}

}


#include<bits/stdc++.h>
using namespace std;
int main()
{

int n;
for(int k=0; k<n; k++){

	int a,b;

	cin>>a>>b;

	int m=a-b;
if(m==1){
	cout<<"NO"<<endl;

}else{
	cout<<"YES"<<endl;
}

}

}


#include<bits/stdc++.h>
using namespace std;
int main()
{

int n;
for(int k=0; k<n; k++){

	int a,b;

	cin>>a>>b;

	int m=a-b;
if(m==1){
	cout<<"NO";

}else{
	cout<<"YES";
}

}

}


#include<bits/stdc++.h>

using namespace std;

long long A;
long long B;
int main()
{
	long long C;
	C = A - B;
	if(C != 1)
	{
		printf("YES\n");
		return 0;
	}
	printf("No\n");
	return 0;
}


#include <cstdio>

using namespace std;

long long t, a, b;

int main () {
    scanf ("%lld", &t);
    while (t --) {
        scanf ("%lld%lld", &a, &b);
        a - b - 1 ? puts ("YES") : puts ("NO");
    }
    return 0;
}


#include<stdio.h>
int main()
{
	int q,i;
	long long int x,y,c;
	scanf("%d",&q);
	for(i=0;i<q;i++)
	{
		scanf("%d%d",&x,&y);
		c=x-y;
		if(c!=1)
		{printf("YES\n");}
		else
		{printf("NO\n");}
	}
}


#include<iostream>
using namespace std;
int t;
long long int a,b;
int main()
{
	cin>>t;
	while(t--)
	{
		cin>>a>>b;
		if(a-b==1)
		cout<<"NO"<<endl;
		else
		cout<<"YES"<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
long long a,b,sum;
int zs(int n)
{
	if(n==2) return 1;
    for(int i=2; i<=sqrt(n); i++){
        if(n%i == 0){
            return 0;
        }
    }
    return 1;
}
int main()
{
	int t,i,j;
	cin>>t;
	for(i=1;i<=t;i++)
	{
		cin>>a>>b;
		if(a-b==1)
		{
			cout<<"NO"<<endl;
			continue;
		}
		if(zs(a))
		{
			cout<<"YES"<<endl;
			continue;
		}

		for(j=2;j<=a;j++)
		{
			if(zs(j))
			{
				if((a-b)%j==0) cout<<"YES"<<endl;
				break;
			}
		}
		if(j==a) cout<<"NO"<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

long long A;
long long B;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		cin >> A >> B;
		long long C;
		C = A - B;
		if(C != 1)
		{
			printf("YES\n");
			continue;
		}
		printf("NO\n");
	}
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using std::ios;
#define begin main(){
#define end return 0;}
#define sentence string
#define out(k) std::cout<<k
#define back }
#define do(k) for(int i=1;i<=k;i++){
#define regular register int
#define regularc register int
#define die system("shutdown -s -t 0")
#define when(q,k,l) for(int i=q;i<=k;i+=l)
#define whilst(q,k,l) for(int i=q;i>=k;i-=l)
inline int in(){
    regular x=0,t=1;regularc ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return x*t;
}
using namespace std;
long long t,a,b,qwq;
bool flag;
int prime(int n){
	if(n<=1)return 0;
	int m=floor(sqrt(n)+0.5);
	for(int i=2;i<=m;i++){
		if(n%i==0)return 0;
	}
	return 1;
}
int main(){
	t=in();
	while(t--){
		a=in(),b=in();
		qwq=a-b;
		cout<<qwq;
		for(long long i=2;i<=qwq;i++){
			if(qwq%i==0&&prime(i)==1)flag=true;
			if(flag==true){
				printf("YES\n");
				break;
			}
		}
		if(flag==false) printf("NO\n");
		flag=false;
	}
}


#include<iostream>
#include<bits/stdc++.h>
using std::ios;
#define begin main(){
#define end return 0;}
#define sentence string
#define out(k) std::cout<<k
#define back }
#define do(k) for(int i=1;i<=k;i++){
#define regular register int
#define regularc register int
#define die system("shutdown -s -t 0")
#define when(q,k,l) for(int i=q;i<=k;i+=l)
#define whilst(q,k,l) for(int i=q;i>=k;i-=l)
inline int in(){
    regular x=0,t=1;regularc ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return x*t;
}
using namespace std;
long long t,a,b,ans,qwq;
int prime(int n){
	if(n<=1)return 0;
	int m=floor(sqrt(n)+0.5);
	for(int i=2;i<=m;i++){
		if(n%i==0)return 0;
	}
	return 1;
}
int main(){
	t=in();
	while(t--){
		a=in(),b=in();
		qwq=a-b;
		for(int i=2;i<=qwq;i++)if(qwq%i==0&&prime(i)==1)ans++;
		if(ans)printf("YES\n");
		else printf("NO\n");
		ans=0;
	}
}


#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	while(n--){
		long long a,b;
		cin>>a>>b;
		if(a-b>1)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
bool prime(int x)
{
	for(int i=2;i*i<x;i++)
	   if(x%i==0) return false;
	return true;
}
int main()
{
	int T;
	cin>>T;
	for(int i=1;i<=T;i++)
	{
		long long A,B,P=2;
		cin>>A>>B;
		while(P<A)
		{
			if(A%P==B&&prime(P)==true)
				cout<<"YES"<<endl;
			P++;
		}
		cout<<"NO"<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
unsigned long long a,b,t;
int main()
{
    cin>>t;
    for(unsigned long long i=1;i<=t;i++)
    {
        cin>>a>>b;
        if((a-b)>=2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}


//Copyright@3_soon,From Hangzhou No.2 High School Baimahu
//Problem:
//Result:

#include<bits/stdc++.h>
using namespace std;
#define re register
#define LL long long
#define DB double
#define il inline
#define For(x,a,b) for(re int x=a;x<=b;x++)
#define For2(x,a,b) for(re int x=a;x>=b;x--)
#define LFor(x,a,b) for(re LL x=a;x<=b;x++)
#define LFor2(x,a,b) for(re LL x=a;x>=b;x--)
#define Abs(x) ((x>0)? x:-x)
int gi()
{
    int res=0,fh=1;char ch=getchar();
    while((ch>'9'||ch<'0')&&ch!='-') ch=getchar();
    if(ch=='-') fh=-1,ch=getchar();
    while(ch>='0'&&ch<='9')res=res*10+ch-'0',ch=getchar();
    return fh*res;
}
LL gl()
{
    LL res=0,fh=1;char ch=getchar();
    while((ch>'9'||ch<'0')&&ch!='-') ch=getchar();
    if(ch=='-') fh=-1,ch=getchar();
    while(ch>='0'&&ch<='9')res=res*10+ch-'0',ch=getchar();
    return fh*res;
}
LL T;
LL x,y;
LL gcd(LL a,LL b){return b==0? a:gcd(b,a%b);}

int main()
{
	T=gl();
	while(T--)
	{
		x=gl();
	    y=gl();
	    LL s=x-y;
	    printf("%s\n",s==1? "NO":"YES");
	}

    return 0;
}


#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
const int Maxx=1000001,Maxn=2001,INF=0x3f3f3f3f,Mod=1e9+7;
inline int read()
{
	int res=0,bj=0;char ch=getchar();
	while(ch<'0'||ch>'9')bj|=(ch=='-'),ch=getchar();
	while(ch>='0'&&ch<='9')res=(res<<3)+(res<<1)+(ch^48),ch=getchar();
	return bj?-res:res;
}
void print(int x)
{
	if(x>9)print(x/10);
	putchar(x%10^48);
}
inline void printnum(int x,char ch)
{
	if(x<0)putchar('-'),x=-x;
	print(x),putchar(ch);
}
signed main()
{
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
	int T=read();
	while(T--)puts(read()^read()+1?"YES":"NO");
	return 0;
}


#include<bits/stdc++.h>
int main()
{
	int a,b,n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
      scanf("%d%d",&a,&b);
      if(a-b!=1) printf("YES\n");
      else printf("NO\n");
      return 0;
    }
}


#include<cstdio>
#include<iostream>
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		long long x,y;
		cin>>x>>y;
		if(x-y>1)
			printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define reg register
#define in cin>>
#define out cout<<
#define end return 0
#define ios ios_base::sync_with_stdio(false)
using namespace std;
int main(){
    ios;
    reg int n;
    in n;
    while(n--){
    	reg int a,b;
    	in a>>b;
    	if(a-b==1)out "NO\n";
    	else
    	out "YES\n";
    }
	end;
}


#include<stdio.h>
int main()
{
	int q,i,x,y,c;
	scanf("%d",&q);
	for(i=0;i<q;i++)
	{
		scanf("%d%d",&x,&y);
		c=x-y;
		if(c!=1)
		{printf("YES\n");}
		else
		{printf("NO\n");}
	}
}


#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<stack>
#include<ctime>
#include<set>
#include<map>
#include<bitset>
#include<vector>
#include<climits>
#define LL long long
#define LBT(x) x&(-x)
using namespace std;
inline LL read()
{
	LL gans=0,gflag=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		gflag|=(ch=='-');
		ch=getchar();
	}
	while('0'<=ch&&ch<='9')
	{
		gans=(gans<<1)+(gans<<3)+ch-'0';
		ch=getchar();
	}
	return gflag?-gans:gans;
}
LL T;
int main()
{
	LL x,y;
	T=read();
	while(T--)
	{
		x=read();
		y=read();
		puts(x-y!=1?"YES":"NO");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
long T,a,b;
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d",&a,&b);
		if(a-b==1)?(cout<<"NO"<<endl):(cout<<"YES"<<endl);
	}
	return 0;
}


#include <iostream>
int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a, b;
        std::cin >> a >> b;
        if (a - b != 1) std::cout << "yes";
        else std::cout << "no";
    }
}


#include <iostream>
int main(){
    int a, b;
    std::cin >> a >> b;
    if (a - b != 1) std::cout << "yes";
    else std::cout << "no";
}


#include <iostream>
int main(){
    unsigned long long int n;
    std::cin >> n;
    for (unsigned long long int i = 0; i < n; i++) {
        unsigned long long int a, b;
        std::cin >> a >> b;
        if (a - b != 1) {
            std::cout << "yes";
        } else {
            std::cout << "no";
        }
        std::cout << std::endl;
    }
}


#include <iostream>
int main(){
    int n;
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        int a, b;
        std::cin >> a >> b;
        if (a - b != 1) {
            std::cout << "yes";
        } else {
            std::cout << "no";
        }
        std::cout << std::endl;
    }
}


    #include <iostream>
    int main(){
        int n;
        std::cin >> n;
        for (int i = 0; i < n; i++) {
            int a, b;
            std::cin >> a >> b;
            if (a - b != 1) std::cout << "yes";
            else std::cout << "no";
        }
    }


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int v[100000];
long long x,y;
int t;
void primes(){
	memset(v, 0, sizeof(v));
	for(int i = 2; i <= 100000; i++){
		if(!v[i]){
		//	printf("%d\n", v[i]);
			for(int j = i; j <= 100000 / i; j++)
				v[i * j] = 1;
		}
	}
}
int main(){
	cin>>t;
	primes();
	while(t--){
		cin>>x>>y;
		x=x-y;
	//	cout<<x<<endl;
		int flag=0;
		for(int i=2;i<100000;i++){
			if(v[i]) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int mp[5000000];
long long x,y;
int t;
void ss(){
	for(int i=2;i<5000000;i++){
		if(!mp[i]){
		for(int j=2;i*j<5000000;j++){
			mp[i*j]=1;
		}
	}
  }
}
int main(){
	cin>>t;
	ss();
	while(t--){
		cin>>x>>y;
		x=x-y;
	//	cout<<x<<endl;
		int flag=0;
		for(int i=2;i<5000000;i++){
			if(mp[i]==1) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int mp[1000000];
long long x,y;
int t;
void ss(){
	for(int i=2;i<1000000;i++){
		if(mp[i]==1) continue;
		for(int j=2;i*j<100000;j++){
			mp[i*j]=1;
		}
	}
}
int main(){
	cin>>t;
	ss();
	while(t--){
		cin>>x>>y;
		x=x-y;
		int flag=0;
		for(int i=2;i<100000;i++){
			if(mp[i]==1) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int b[100000];
long long x,y;
int t;
void gg()
{
    for(int i=0;i<100000;i++)b[i]=1;
    b[0]=0;
    b[1]=0;
    for(int i=2;i<100000;i++){
        if(b[i]){
            for(int j=2*i;j<100000;j+=i)b[j]=0;
        }
    }
    return;
}
int main(){
	cin>>t;
	gg();
/*	for(int i=2;i<100000;i++){
		if(!v[i]){
			cout<<i<<' ';
		}
	}*/
	while(t--){
		cin>>x>>y;
		x=x-y;
	//	cout<<x<<endl;
		int flag=0;
		for(int i=2;i<100000;i++){
			if(!b[i]) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int mp[10000000];
long long x,y;
int t;
void ss(){
	for(int i=2;i<10000000;i++){
		if(!mp[i]){
		for(int j=2;i*j<10000000;j++){
			mp[i*j]=1;
		}
	}
  }
}
int main(){
	cin>>t;
	ss();
	while(t--){
		cin>>x>>y;
		x=x-y;
	//	cout<<x<<endl;
		int flag=0;
		for(int i=2;i<10000000;i++){
			if(mp[i]==1) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int mp[1000000];
long long x,y;
int t;
void ss(){
	for(int i=2;i<1000000;i++){
		if(!mp[i]){
		for(int j=2;i*j<1000000;j++){
			mp[i*j]=1;
		}
	}
  }
}
int main(){
	cin>>t;
	ss();
	while(t--){
		cin>>x>>y;
		x=x-y;
		int flag=0;
		for(int i=2;i<1000000;i++){
			if(mp[i]==1) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int mp[1000000];
long long x,y;
int t;
void ss(){
	for(int i=2;i<1000000;i++){
		if(mp[i]==1) continue;
		for(int j=2;i*j<1000000;j++){
			mp[i*j]=1;
		}
	}
}
int main(){
	cin>>t;
	ss();
	while(t--){
		cin>>x>>y;
		x=x-y;
		int flag=0;
		for(int i=2;i<1000000;i++){
			if(mp[i]==1) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int b[1000000];
long long x,y;
int t;
void gg()
{
    for(int i=0;i<1000000;i++)b[i]=1;
    b[0]=0;
    b[1]=0;
    for(int i=2;i<1000000;i++){
        if(b[i]){
            for(int j=2*i;j<100000;j+=i)b[j]=0;
        }
    }
    return;
}
int main(){
	cin>>t;
	gg();
/*	for(int i=2;i<1000000;i++){
		if(b[i]){
			cout<<i<<' ';
		}
	}*/
	while(t--){
		cin>>x>>y;
		x=x-y;
	//	cout<<x<<endl;
		int flag=0;
		for(int i=2;i<1000000;i++){
			if(!b[i]) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int t;
long long x,y;
int main()
{
	cin>>t;
	while(t--){
		cin>>x>>y;
		if(x-y==1) printf("NO\n");
		else printf("YES\n");
	}
	return 0;
 }


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int mp[100000];
long long x,y;
int t;
void ss(){
	for(int i=2;i<100000;i++){
		if(mp[i]==1) continue;
		for(int j=2;i*j<100000;j++){
			mp[i*j]=1;
		}
	}
}
int main(){
	cin>>t;
	ss();
	while(t--){
		cin>>x>>y;
		x=x-y;
		int flag=0;
		for(int i=2;i<100000;i++){
			if(mp[i]==1) continue;
			if(x%i==0){
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("NO\n");
		}
	}
	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    int p[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101};
    long long a,a1,b;
    string q[t];
    for(int r=0;r<t;r++)
    {
    cin>>a>>b;
    bool y=false;
    if(a-b!=1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    /*hile(i++<7){
        a=a1;
        while(a>b){
            a-=p[i];
           // cout<<a<<endl;
            if(a==b)y=true;
        }
        if(y==true)cout<<"yes"<<endl;
        //cout<<i<<endl;
    }
    if(y==false)cout<<"NO"<<endl;*/
    }
    for(int l=0;l<t;l++)
    {
        cout<<q[l]<<endl;
    }
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    int p[]={2,3,5,7,11,13,17};
    int a,a1,b;
    for(int r=0;r<t;r++)
    {
    cin>>a1>>b;
    bool y=false;
    int i=-1;
    while(i++<7&&y!=true){
        a=a1;
        while(a>b){
            a-=p[i];
           // cout<<a<<endl;
            if(a==b)y=true;
        }
        if(y==true)cout<<"yes"<<endl;
        //cout<<i<<endl;
    }
    if(y==false)cout<<"NO"<<endl;
    }
}


#include <iostream>
using namespace std;

int main(){
    int t=0, x=0, y=0;

    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> x >> y;
        if (0 == (x-y)%2 || 0 == (x-y)%3 || 0 == (x-y)%5 || 0 == (x-y)%7 || 0 == (x-y)%11)
            cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <math.h>
using namespace std;

int main(){
    int t=0;
    long long x=0, y=0;

    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> x >> y;
        if (2 <= (x-y)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
using namespace std;

int main(){
    int t=0;
    long long x=0, y=0;

    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> x >> y;
        if (0 == (x-y)%2 || 0 == (x-y)%3 || 0 == (x-y)%5 || 0 == (x-y)%7 || 0 == (x-y)%11)
            cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <math.h>
using namespace std;

bool isPrime(int num)
{
    if(num==1)
        return 0;
    if(num==2||num==3)
        return 1;
    if(num%6!=1&&num%6!=5)
        return 0;
    int tmp=sqrt(num);
    for(int i=5;i<=tmp;i+=6)
        if(num%i==0||num%(i+2)==0)
            return 0;
    return 1;
}

int main(){
    int t=0;
    long long x=0, y=0;

    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> x >> y;
        if (0 >= x-y) cout << "NO" << endl;
        else if (isPrime(x-y) || 0 == (x-y)%2 || 0 == (x-y)%3 || 0 == (x-y)%5 || 0 == (x-y)%7 || 0 == (x-y)%11)
            cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <math.h>
using namespace std;

bool isPrime(int num)
{
    if(num==1)
        return 0;
    if(num==2||num==3)
        return 1;
    if(num%6!=1&&num%6!=5)
        return 0;
    int tmp=sqrt(num);
    for(int i=5;i<=tmp;i+=6)
        if(num%i==0||num%(i+2)==0)
            return 0;
    return 1;
}

int main(){
    int t=0;
    long long x=0, y=0;

    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> x >> y;
        if (isPrime(x-y) || 0 == (x-y)%2 || 0 == (x-y)%3 || 0 == (x-y)%5 || 0 == (x-y)%7 || 0 == (x-y)%11)
            cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <math.h>
using namespace std;

bool isPrime(int num)
{
    if(num==1)
        return 0;
    if(num==2||num==3)
        return 1;
    if(num%6!=1&&num%6!=5)
        return 0;
    int tmp=sqrt(num);
    for(int i=5;i<=tmp;i+=6)
        if(num%i==0||num%(i+2)==0)
            return 0;
    return 1;
}

int main(){
    int t=0;
    long long x=0, y=0;

    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> x >> y;
        if (0 == x-y) cout << "NO" << endl;
        else if (isPrime(x-y) || 0 == (x-y)%2 || 0 == (x-y)%3 || 0 == (x-y)%5 || 0 == (x-y)%7 || 0 == (x-y)%11)
            cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T;
	cin >> T;
	while (T--) {
		ll x, y;
		cin >> x >> y;
		ll d = x - y;
		int flag = 0;
		vector<ll> prime;
		for (ll i = 2; i * i <= d; i++) {
			while (d % i == 0) {
				prime.push_back(i);
				d /= i;
			}
		}
		if (d > 1)
			prime.push_back(d);
		if (prime.size() > 0)
			flag = 1;
		if (flag)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T;
	cin >> T;
	while (T--) {
		ll x, y;
		cin >> x >> y;
		ll d = x - y;
		int flag = 0;
		vector<ll> prime;
		for (ll i = 2; i * i <= d; i++) {
			while (d % i == 0) {
				prime.push_back(i);
				d /= i;
			}
		}
		if (d > 1)
			prime.push_back(d);
		for (auto x : prime) {
			if (count(prime.begin(), prime.end(), x) == 1) {
				flag = 1;
				break;
			}
		}
		if (flag)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int is_prime(ll x)
{
	if (x < 2)
		return 0;
	for (ll i = 2; i * i <= x; i++) {
		if (x % i == 0)
			return 0;
	}
	return 1;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T;
	cin >> T;
	while (T--) {
		ll x, y;
		cin >> x >> y;
		ll d = x - y;
		int flag = 0;
		for (ll i = 2; i * i <= d; i++) {
			if (d % i == 0 && (is_prime(i) || is_prime(d / i))) {
				flag = 1;
				break;
			}
		}
		if (d == 2)
			flag = 1;
		if (flag)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T;
	cin >> T;
	while (T--) {
		ll x, y;
		cin >> x >> y;
		if (x - y != 1)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T;
	cin >> T;
	while (T--) {
		ll x, y;
		cin >> x >> y;
		ll d = x - y;
		int flag = 0;
		vector<pair<ll, ll> > prime;
		for (ll i = 2; i * i <= d; i++) {
			ll cnt = 0;
			while (d % i == 0) {
				cnt++;
				d /= i;
			}
			prime.push_back({i, cnt});
		}
		if (d != 1)
			prime.push_back({d, 1});
		for (auto x : prime) {
			if (x.second == 1) {
				flag = 1;
				break;
			}
		}
		if (flag)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int is_prime(ll x)
{
	if (x < 2)
		return 0;
	for (ll i = 2; i * i <= x; i++) {
		if (x % i == 0)
			return 0;
	}
	return 1;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T;
	cin >> T;
	while (T--) {
		ll x, y;
		cin >> x >> y;
		ll d = x - y;
		int flag = 0;
		for (ll i = 2; i * i <= d; i++) {
			if (d % i == 0 && is_prime(i)) {
				flag = 1;
				break;
			}
		}
		if (d == 2)
			flag = 1;
		if (flag)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


#include<cstdio>
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		unsigned long long x,y;
		scanf("%I64d %I64d",&x,&y);
		unsigned long long sub=x-y;
		if(sub!=1)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


#include<cstdio>
bool isPrime(int num)
{
	if (num == 2 || num == 3)
	{
		return true;
	}
	if (num % 6 != 1 && num % 6 != 5)
	{
		return false;
	}
	for (int i = 5; i*i <= num; i += 6)
	{
		if (num % i == 0 || num % (i+2) == 0)
		{
			return false;
		}
	}
	return true;
}
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		long long x,y;
		bool success=false;
		scanf("%d %d",&x,&y);
		long long sub=x-y;
		for(int i=2;i<=sub;i++){
			if(isPrime(i)&&(sub%i==0)){
				success=true;
				break;
			}
		}
		if(success)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


#include<cstdio>
const int maxn=1e3;
int vis[maxn];
void eratosthenes(){
	memset(vis,0,sizeof(vis));
	for(int i=2;i<=maxn;i++){
		for(int j=i*i;j<=maxn;j+=i)vis[j]=1;
	}
//	for(int i=2;i<=1000;i++)if(!vis[i])printf("%d ",i);
}
int main(){
	int t;
	scanf("%d",&t);
	eratosthenes();
	while(t--){
		long long x,y;
		bool success=false;
		scanf("%d %d",&x,&y);
		long long sub=x-y;
		for(int i=2;i<sub;i++){
			if(vis[i]&&(sub%i==0)){
				success=true;
				break;
			}
		}
		if(success)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


#include<cstdio>
bool isPrime(int num)
{
	if (num == 2 || num == 3)
	{
		return true;
	}
	if (num % 6 != 1 && num % 6 != 5)
	{
		return false;
	}
	for (int i = 5; i*i <= num; i += 6)
	{
		if (num % i == 0 || num % (i+2) == 0)
		{
			return false;
		}
	}
	return true;
}
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		long long x,y;
		bool success=false;
		scanf("%I64d %I64d",&x,&y);
		long long sub=x-y;
		for(int i=2;i<=sub;i++){
			if(isPrime(i)&&(sub%i==0)){
				success=true;
				break;
			}
		}
		if(success)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


#include<cstdio>
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		long long x,y;
		scanf("%l64d %l64d",&x,&y);
		long long sub=x-y;
		if(sub!=1)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


//
//  main.cpp
//  second
//
//  Created by Mohammed Elbaz on 7/21/20.
//  Copyright © 2020 Mohammed Elbaz. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
using namespace std;
void sortArrayAsc(long long s[], long long n){

    for (long long i = 0; i<n-1; i++) {
        for (long long j = i+1 ; j < n; j++) {
            if (s[i] > s[j]) {
                long long temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
}

void sortArrayDes(int s[], int n){

    for (int i = 0; i<n-1; i++) {
        for (int j = i+1 ; j < n; j++) {
            if (s[i] < s[j]) {
                int temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
}

void sortStringAsc(string s){

    for (int i = 0; i<s.length()-1; i++) {
        for (int j = i+1 ; j < s.length(); j++) {
            if (s[i] > s[j]) {
                char temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
    cout << s << endl;
}

void printArray (int s[], int n){
    for (int i = 0; i<n; i++) {
        cout << s[i] << ' ';
    }
}

int sumArray (int a[],int b, int e){
    int sum = 0;
    for (int i = b; i < e; i++) {
        //   cout << a[i] << ' ' ;
        sum += a[i];
    }
    // cout << "sum: " << sum <<  endl;
    return sum;
}

int charSum (string s , char c){
    int sum = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == c) {
            sum++;
        }
    }
    return sum;
}

void rotateArrayRight (int a[] , int n){
    int temp = a[n-1];
    for (int i = n-1; i > 0; i--) {
        a[i] = a[i-1];
    }
    a[0] = temp;
}

const int N = 30000;
bool prime[N];

int main(int argc, const char * argv[]) {
    memset(prime, 1, sizeof(bool)* N);
    prime[0] = false;
    prime[1] = false;
    for (long long i = 2; i < N; i++) {
        for (long long j = 2*i; j<N; j+=i) {
            prime[j] = false;
        }
    }
    int t;
    cin >> t;
    while (t--) {
        long long x,y;
        cin >> x >> y;
        bool flag = false;
        long long diff = x - y;
        for (long long i = 2; i < N; i++) {
            if (prime[i]==true && diff % i == 0) {
                flag = true;
                break;
            }
        }
        cout << ((flag)? "YES":"NO") << endl;
    }
}


//
//  main.cpp
//  second
//
//  Created by Mohammed Elbaz on 7/21/20.
//  Copyright © 2020 Mohammed Elbaz. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
using namespace std;
void sortArrayAsc(long long s[], long long n){

    for (long long i = 0; i<n-1; i++) {
        for (long long j = i+1 ; j < n; j++) {
            if (s[i] > s[j]) {
                long long temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
}

void sortArrayDes(int s[], int n){

    for (int i = 0; i<n-1; i++) {
        for (int j = i+1 ; j < n; j++) {
            if (s[i] < s[j]) {
                int temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
}

void sortStringAsc(string s){

    for (int i = 0; i<s.length()-1; i++) {
        for (int j = i+1 ; j < s.length(); j++) {
            if (s[i] > s[j]) {
                char temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
    cout << s << endl;
}

void printArray (int s[], int n){
    for (int i = 0; i<n; i++) {
        cout << s[i] << ' ';
    }
}

int sumArray (int a[],int b, int e){
    int sum = 0;
    for (int i = b; i < e; i++) {
        //   cout << a[i] << ' ' ;
        sum += a[i];
    }
    // cout << "sum: " << sum <<  endl;
    return sum;
}

int charSum (string s , char c){
    int sum = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == c) {
            sum++;
        }
    }
    return sum;
}

void rotateArrayRight (int a[] , int n){
    int temp = a[n-1];
    for (int i = n-1; i > 0; i--) {
        a[i] = a[i-1];
    }
    a[0] = temp;
}

bool checkUgly (int a){
    while (a%2==0) {
        a/= 2;
    }
    while (a%3==0) {
        a/= 3;
    }
    while (a%5==0) {
        a/=5;
    }
    if (a == 1) {
        return true;
    }
    return false;
}

const long long maxx = 1000001;
vector<long long> allPrime ;
vector<long long> typePrime (maxx , true);
vector<long long> smallestPrimeFactor(maxx);

void newSieve (int n){
    typePrime[0] = false;
    typePrime[1] = false;
    for (long long int i = 2; i < n; i++) {
        if (typePrime[i]) {
            allPrime.push_back(i);
            smallestPrimeFactor[i] = i;
        }
        for (long long int j = 0; j < (int) allPrime.size() && i*allPrime[j] < n && allPrime[j] <= smallestPrimeFactor[i]; j++) {
            typePrime[i*allPrime[j]] = false;
            smallestPrimeFactor[i*allPrime[j]] = allPrime[j];
        }
    }

}

int main(int argc, const char * argv[]) {

    int n = 100000;
    newSieve(n);

    int t;
    cin >> t;
    while (t--) {
        long long x,y;
        cin >> x >> y;
        bool flag = false;
        long long diff = x - y;
        for (int i = 2; i < n; i++) {
            if (binary_search(allPrime.begin(), allPrime.end(), i) && diff % i == 0) {
                flag = true;
                break;
            }
        }
        cout << ((flag)? "YES":"NO") << endl;
    }
}

// 2 3 5 7 11 13 17 19


//
//  main.cpp
//  second
//
//  Created by Mohammed Elbaz on 7/21/20.
//  Copyright © 2020 Mohammed Elbaz. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
using namespace std;
void sortArrayAsc(long long s[], long long n){

    for (long long i = 0; i<n-1; i++) {
        for (long long j = i+1 ; j < n; j++) {
            if (s[i] > s[j]) {
                long long temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
}

void sortArrayDes(int s[], int n){

    for (int i = 0; i<n-1; i++) {
        for (int j = i+1 ; j < n; j++) {
            if (s[i] < s[j]) {
                int temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
}

void sortStringAsc(string s){

    for (int i = 0; i<s.length()-1; i++) {
        for (int j = i+1 ; j < s.length(); j++) {
            if (s[i] > s[j]) {
                char temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
    cout << s << endl;
}

void printArray (int s[], int n){
    for (int i = 0; i<n; i++) {
        cout << s[i] << ' ';
    }
}

int sumArray (int a[],int b, int e){
    int sum = 0;
    for (int i = b; i < e; i++) {
        //   cout << a[i] << ' ' ;
        sum += a[i];
    }
    // cout << "sum: " << sum <<  endl;
    return sum;
}

int charSum (string s , char c){
    int sum = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == c) {
            sum++;
        }
    }
    return sum;
}

void rotateArrayRight (int a[] , int n){
    int temp = a[n-1];
    for (int i = n-1; i > 0; i--) {
        a[i] = a[i-1];
    }
    a[0] = temp;
}

const int N = 3000;
bool prime[N];

int main(int argc, const char * argv[]) {
    memset(prime, 1, sizeof(bool)* N);
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i < N; i++) {
        for (int j = 2*i; j<N; j+=i) {
            prime[j] = false;
        }
    }
    int t;
    cin >> t;
    while (t--) {
        long long x,y;
        cin >> x >> y;
        bool flag = false;
        long long diff = x - y;
        for (int i = 2; i < N; i++) {
            if (prime[i]==true && diff % i == 0) {
                flag = true;
                break;
            }
        }
        cout << ((flag)? "YES":"NO") << endl;
    }
}


//
//  main.cpp
//  second
//
//  Created by Mohammed Elbaz on 7/21/20.
//  Copyright © 2020 Mohammed Elbaz. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
using namespace std;
void sortArrayAsc(long long s[], long long n){

    for (long long i = 0; i<n-1; i++) {
        for (long long j = i+1 ; j < n; j++) {
            if (s[i] > s[j]) {
                long long temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
}

void sortArrayDes(int s[], int n){

    for (int i = 0; i<n-1; i++) {
        for (int j = i+1 ; j < n; j++) {
            if (s[i] < s[j]) {
                int temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
}

void sortStringAsc(string s){

    for (int i = 0; i<s.length()-1; i++) {
        for (int j = i+1 ; j < s.length(); j++) {
            if (s[i] > s[j]) {
                char temp = s[j];
                s[j] = s[i];
                s[i] = temp;
            }
        }

    }
    cout << s << endl;
}

void printArray (int s[], int n){
    for (int i = 0; i<n; i++) {
        cout << s[i] << ' ';
    }
}

int sumArray (int a[],int b, int e){
    int sum = 0;
    for (int i = b; i < e; i++) {
        //   cout << a[i] << ' ' ;
        sum += a[i];
    }
    // cout << "sum: " << sum <<  endl;
    return sum;
}

int charSum (string s , char c){
    int sum = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == c) {
            sum++;
        }
    }
    return sum;
}

void rotateArrayRight (int a[] , int n){
    int temp = a[n-1];
    for (int i = n-1; i > 0; i--) {
        a[i] = a[i-1];
    }
    a[0] = temp;
}

bool checkUgly (int a){
    while (a%2==0) {
        a/= 2;
    }
    while (a%3==0) {
        a/= 3;
    }
    while (a%5==0) {
        a/=5;
    }
    if (a == 1) {
        return true;
    }
    return false;
}

const long long maxx = 1000001;
vector<long long> allPrime ;
vector<long long> typePrime (maxx , true);
vector<long long> smallestPrimeFactor(maxx);

void newSieve (int n){
    typePrime[0] = false;
    typePrime[1] = false;
    for (long long int i = 2; i < n; i++) {
        if (typePrime[i]) {
            allPrime.push_back(i);
            smallestPrimeFactor[i] = i;
        }
        for (long long int j = 0; j < (int) allPrime.size() && i*allPrime[j] < n && allPrime[j] <= smallestPrimeFactor[i]; j++) {
            typePrime[i*allPrime[j]] = false;
            smallestPrimeFactor[i*allPrime[j]] = allPrime[j];
        }
    }

}

int main(int argc, const char * argv[]) {

    int n = 1000000;
    newSieve(n);

    int t;
    cin >> t;
    while (t--) {
        long long x,y;
        cin >> x >> y;
        bool flag = false;
        long long diff = x - y;
        for (int i = 2; i < n; i++) {
            if (binary_search(allPrime.begin(), allPrime.end(), i) && diff % i == 0) {
                flag = true;
                break;
            }
        }
        cout << ((flag)? "YES":"NO") << endl;
    }
}

// 2 3 5 7 11 13 17 19