616 4
305 250
558 43
182 37
297 138 60 5
60 28
32 38
31 44
48 30
14 34 7 6
5 5
1 5
4 5
3 6
1 5
3 3
YES
YES
NO
NO
 YES
YES
YES
YES
NO
 NO
YES
NO
NO
NO
NO

import sys

n,q = map(int,sys.stdin.readline().split())

l = [x for x in xrange(1,n+1)]

l1 = [l]
a = set()

for queries in xrange(q):
	n1,n2 = map(int,sys.stdin.readline().split())
	if n1==n2:
		print "NO"
		continue
	t = 0
	flag = True
	for i in l1:
		if (n1 in i) and (n2 in i):
			w1,q1 = i.index(n1),i.index(n2)
			s,f = min(w1,q1),max(w1,q1)
			if s == 0 and f == len(i)-1:
				#print 1
				if i[1:f] != []:
					l1.append(i[1:f])
			elif s == 0:
				#print 2
				if i[1:f] != []:
					l1.append(i[1:f])
				if i[f+1:] != []:
					l1.append(i[f+1:])
			elif f == len(i)-1:
				#print 3
				if i[:s]!=[]:
					l1.append(i[:s])
				if i[s+1:f]!=[]:		
					l1.append(i[s+1:f])
			else:
				#print 4
				if i[s+1:f]!=[]:
					l1.append(i[s+1:f])
				if i[f+1:]+i[:s] != []:
					l1.append(i[f+1:]+i[:s])
			print "YES"
			del l1[t]
			#print "l1 = ",l1
			flag = False
			break
		t += 1
	if flag:
		print "NO"