AtCoder Grand Contest 014 - Unplanned Queries

Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice.

First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge.

Then, Aoki gave him M queries. The i-th of them is as follows:

* Increment the number written at each edge along the path connecting vertices a_i and b_i, by one.



After Takahashi executed all of the queries, he told Aoki that, for every edge, the written number became an even number. However, Aoki forgot to confirm that the graph Takahashi created was actually a tree, and it is possible that Takahashi made a mistake in creating a tree or executing queries.

Determine whether there exists a tree that has the property mentioned by Takahashi.

Constraints

* 2 ≤ N ≤ 10^5
* 1 ≤ M ≤ 10^5
* 1 ≤ a_i,b_i ≤ N
* a_i ≠ b_i

Input

Input is given from Standard Input in the following format:


N M
a_1 b_1
:
a_M b_M


Output

Print `YES` if there exists a tree that has the property mentioned by Takahashi; print `NO` otherwise.

Examples

Input

4 4
1 2
2 4
1 3
3 4


Output

YES


Input

5 5
1 2
3 5
5 1
3 4
2 3


Output

NO

Source: atcoder | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
(N, M) = map(int, input().split())
cnt = [0] * (N + 10)
for i in range(M):
	(a, b) = map(int, input().split())
	cnt[a] += 1
	cnt[b] += 1
for c in cnt:
	if c % 2 == 1:
		print('NO')
		import sys
		sys.exit()
print('YES')


(N, M) = map(int, input().split())
Ans = [0] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	Ans[a] += 1
	Ans[b] += 1
for a in Ans:
	if a % 2 != 0:
		print('NO')
		exit()
print('YES')


(N, M) = map(int, input().split())
from collections import defaultdict
cnt = defaultdict(int)
for i in range(M):
	(a, b) = map(int, input().split())
	cnt[a - 1] += 1
	cnt[b - 1] += 1
for i in range(N):
	if cnt[i] % 2 == 1:
		print('NO')
		exit()
print('YES')


(N, M) = map(int, input().split())
import collections
e = []
for i in range(M):
	(ta, tb) = map(int, input().split())
	e.extend([ta, tb])
c = collections.Counter(e)
ans = 'YES'
for i in c:
	if c[i] % 2 != 0:
		ans = 'NO'
print(ans)


(n, m) = map(int, input().split())
cnt = [0] * (n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	cnt[a] ^= 1
	cnt[b] ^= 1
for i in cnt:
	if i:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
cnt = {i: 0 for i in range(1, n + 1)}
for _ in range(m):
	(a, b) = map(int, input().split())
	cnt[a] += 1
	cnt[b] += 1
if all((cnt[i] % 2 == 0 for i in range(1, n + 1))):
	print('YES')
else:
	print('NO')


from collections import defaultdict
(n, m) = map(int, input().split())
cnt = defaultdict(int)
for _ in range(m):
	(a, b) = map(int, input().split())
	cnt[a] ^= 1
	cnt[b] ^= 1
if any((v for v in cnt.values())):
	print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
l = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	l[a - 1] += 1
	l[b - 1] += 1
k = 0
while k < n:
	if l[k] % 2 == 0:
		k += 1
		continue
	else:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
tree = [0] * n
for _ in range(m):
	(x, y) = map(int, input().split())
	tree[x - 1] += 1
	tree[y - 1] += 1
for item in tree:
	if item % 2 == 1:
		print('NO')
		exit()
print('YES')


(N, M) = map(int, input().split())
cnt = [0] * (N + 1)
for _ in range(M):
	(a, b) = map(int, input().split())
	cnt[a] += 1
	cnt[b] += 1
flag = True if all((c % 2 == 0 for c in cnt)) else False
if flag:
	print('YES')
else:
	print('NO')


def inpl():
	return [int(i) for i in input().split()]
(N, M) = inpl()
path = [True for _ in range(N + 1)]
for _ in range(M):
	(a, b) = inpl()
	path[a] = not path[a]
	path[b] = not path[b]
if all(path):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
a = [0] * n
for i in range(m):
	a[l[i][0] - 1] += 1
	a[l[i][1] - 1] += 1
for i in range(n):
	if a[i] % 2 == 1:
		print('NO')
		break
else:
	print('YES')


import sys
input = sys.stdin.readline
(N, M) = map(int, input().split())
table = [0] * (N + 1)
for _ in range(M):
	(u, v) = map(int, input().split())
	table[u] += 1
	table[v] += 1
for i in range(N + 1):
	if table[i] % 2:
		print('NO')
		exit(0)
print('YES')


(N, M) = [int(x) for x in input().split()]
li = [0] * N
for _ in range(M):
	(a, b) = [int(x) - 1 for x in input().split()]
	li[a] += 1
	li[b] += 1
for l in li[1:]:
	if l % 2 != 0:
		print('NO')
		break
else:
	print('YES')


c = [0] * 9 ** 6
for x in open(0).read().split()[2:]:
	c[int(x)] ^= 1
print('YNEOS'[any(c)::2])


(n, m) = map(int, input().split())
ans = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	ans[a] += 1
	ans[b] += 1
	ans[a] %= 2
	ans[b] %= 2
if any(ans):
	print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
dat = [0] * (n + 10)
for _ in range(m):
	(a, b) = map(int, input().split())
	dat[a] += 1
	dat[b] += 1
can = True
for i in range(n):
	if dat[i] % 2 == 1:
		can = False
print('YES' if can else 'NO')


(N, M) = map(int, input().split())
L = [0] * (N + 1)
for _ in range(M):
	(a, b) = map(int, input().split())
	L[a] += 1
	L[b] += 1
ans = 'YES'
for l in L:
	if l % 2 == 1:
		ans = 'NO'
		break
print(ans)


from collections import defaultdict
(N, M) = map(int, input().split())
d = defaultdict(int)
for (a, b) in [tuple(map(int, input().split())) for _ in range(M)]:
	d[a] += 1
	d[b] += 1
if all([i % 2 == 0 for i in d.values()]):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
dic = {}
for i in range(1, n + 1):
	dic[i] = 0
for i in range(m):
	(a, b) = map(int, input().split())
	dic[a] += 1
	dic[b] += 1
ret = 'YES'
for i in range(1, n + 1):
	if dic[i] % 2 == 1:
		ret = 'NO'
		break
print(ret)


(N, M) = map(int, input().split())
cntAB = {i: 0 for i in range(1, N + 1)}
for _ in range(M):
	(a, b) = map(int, input().split())
	cntAB[a] += 1
	cntAB[b] += 1
for (key, num) in cntAB.items():
	if num % 2 == 1:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
d = [0 for i in range(n)]
for i in range(m):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	d[a] ^= 1
	d[b] ^= 1
print('NO' if sum(d) else 'YES')


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
from collections import Counter
l = []
for _ in range(m):
	l += list(map(int, input().split()))
c = Counter(l)
print('YES' if all((v % 2 == 0 for v in c.values())) else 'NO')


(N, M) = map(int, input().split())
node = [0] * (N + 1)
for m in range(M):
	(a, b) = map(int, input().split())
	node[a] += 1
	node[b] += 1
if all(map(lambda x: x % 2 == 0, node)):
	print('YES')
else:
	print('NO')


(N, M) = map(int, input().split())
nums = [0] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	nums[a - 1] += 1
	nums[b - 1] += 1
for num in nums:
	if num % 2:
		print('NO')
		break
else:
	print('YES')


(n, m) = map(int, input().split())
c = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	c[a - 1] += 1
	c[b - 1] += 1
for i in range(n):
	if c[i] % 2:
		print('NO')
		exit(0)
print('YES')


(n, m) = map(int, input().split())
from collections import Counter as co
from itertools import chain
flatten = chain.from_iterable
print('YES' if all((i % 2 == 0 for i in co(flatten([list(map(int, input().split())) for i in range(m)])).values())) else 'NO')


(n, m) = map(int, input().split())
num = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	num[a] += 1
	num[b] += 1
flag = 0
for i in num:
	if i % 2 == 1:
		flag = 1
		break
if bool(flag):
	print('NO')
else:
	print('YES')


from collections import Counter
(N, M, *AB) = map(int, open(0).read().split())
C = Counter(AB)
if any((c % 2 == 1 for c in C.values())):
	print('NO')
else:
	print('YES')


from collections import Counter
(N, M) = map(int, input().split())
Q = []
for _ in range(M):
	(a, b) = map(int, input().split())
	Q.append(a)
	Q.append(b)
C = Counter(Q)
for c in C.values():
	if c & 1:
		print('NO')
		exit()
print('YES')


import sys
from collections import Counter
read = sys.stdin.read
(n, m) = map(int, input().split())
a = list(map(int, read().split()))
c = Counter(a)
ans = 'YES'
for i in c.values():
	if i % 2:
		ans = 'NO'
print(ans)


(N, M, *ab) = open(0).read().split()
from collections import *
C = Counter(ab)
print('YNEOS'[any((v % 2 for v in C.values()))::2])


import sys
imput = sys.stdin.readline
(N, M) = map(int, input().split())
V = [0 for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	V[a - 1] += 1
	V[b - 1] += 1
print('YES' if all([v % 2 == 0 for v in V]) else 'NO')


from collections import Counter
(N, M) = map(int, input().split())
c = []
for i in range(M):
	(a, b) = map(int, input().split())
	c.append(a)
	c.append(b)
c = Counter(c)
if all((cnt % 2 == 0 for cnt in c.values())):
	print('YES')
else:
	print('NO')


from collections import *
print('YNEOS'[any((i % 2 for i in Counter(open(0).read().split()[2:]).values()))::2])


(N, M) = map(int, input().split())
count = [0] * (N + 1)
for _ in range(M):
	(a, b) = map(int, input().split())
	count[a] += 1
	count[b] += 1
ans = 'YES'
for i in range(1, N + 1):
	if count[i] % 2 == 1:
		ans = 'NO'
		break
print(ans)


from collections import Counter
(n, m, *ab) = map(int, open(0).read().split())
a = Counter(ab)
for i in a.values():
	if i % 2 != 0:
		print('NO')
		break
else:
	print('YES')


(N, M) = map(int, input().split())
node = []
dic = {}
for _ in range(M):
	(a, b) = map(int, input().split())
	dic[a] = dic.get(a, 0) + 1
	dic[b] = dic.get(b, 0) + 1
for k in dic:
	if dic[k] % 2 == 1:
		print('NO')
		break
else:
	print('YES')


import collections
(N, M) = map(int, input().split())
L = []
for i in range(M):
	(X, Y) = map(int, input().split())
	L.append(X)
	L.append(Y)
S = collections.Counter(L)
for (i, j) in S.items():
	if j % 2 == 1:
		print('NO')
		exit()
print('YES')


(N, M) = map(int, input().split())
count = [0] * (N + 1)
for i in range(M):
	(a, b) = map(int, input().split())
	count[a] += 1
	count[b] += 1
for i in range(N):
	if count[i] % 2 != 0:
		print('NO')
		exit()
print('YES')


(N, M) = map(int, input().split())
src = [tuple(map(int, input().split())) for i in range(M)]
k = [0] * N
for (a, b) in src:
	(a, b) = (a - 1, b - 1)
	k[a] += 1
	k[b] += 1
print('NO' if any((a % 2 for a in k)) else 'YES')


(N, M) = map(int, input().split())
ver = [0] * N
for i in range(M):
	(a, b) = map(int, input().split())
	ver[a - 1] += 1
	ver[b - 1] += 1
ans = 'YES'
for i in range(N):
	if ver[i] % 2 != 0:
		ans = 'NO'
print(ans)


(n, m) = map(int, input().split())
l = [0 for _ in range(n)]
for i in range(m):
	for j in map(int, input().split()):
		l[j - 1] += 1
c = 0
for i in range(n):
	if l[i] % 2 == 1:
		c += 1
		break
if c == 0:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
cnt = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	cnt[a - 1] += 1
	cnt[b - 1] += 1
ans = 'YES'
for i in range(n):
	if cnt[i] % 2 == 1:
		ans = 'NO'
		break
print(ans)


(N, M) = map(int, input().split())
A = [0] * (N + 1)
for _ in range(M):
	(a, b) = map(int, input().split())
	A[a] = (A[a] + 1) % 2
	A[b] = (A[b] + 1) % 2
print('YES' if len(list(filter(lambda x: x == 1, A))) < 1 else 'NO')


from collections import Counter
(n, q) = map(int, input().split())
c = Counter()
for _ in range(q):
	(u, v) = map(int, input().split())
	c[u] += 1
	c[v] += 1
safe = all((c[x] % 2 == 0 for x in c))
print('YES' if safe else 'NO')


(n, m) = map(int, input().split())
l = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	l[a - 1] += 1
	l[b - 1] += 1
b = True
for i in range(n):
	if l[i] % 2 == 1:
		b = False
if b:
	print('YES')
else:
	print('NO')


(N, M) = map(int, input().split())
l = [0 for i in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	l[a - 1] += 1
	l[b - 1] += 1
for i in l:
	if i % 2 == 1:
		print('NO')
		break
else:
	print('YES')


(n, m) = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
cnt = [0] * n
for tmp in ab:
	(a, b) = tmp
	cnt[a - 1] += 1
	cnt[b - 1] += 1
for c in cnt:
	if c % 2 != 0:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
nnode = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	nnode[a - 1] += 1
	nnode[b - 1] += 1
for i in nnode:
	if i % 2 == 1:
		print('NO')
		break
else:
	print('YES')


(n, m) = map(int, input().split())
t = 0
for i in range(m):
	(u, v) = map(int, input().split())
	t ^= u ^ v
print('NO' if t else 'YES')


(n, m) = map(int, input().split())
lst = [0] * (n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	lst[a] += 1
	lst[b] += 1
res = True
for i in range(1, n + 1):
	if lst[i] % 2 != 0:
		res = False
		break
print('YES' if res else 'NO')


from collections import Counter

def main():
	(N, _, *A) = map(int, open(0).read().split())
	T = Counter(A).values()
	flg = all((i % 2 == 0 for i in T))
	print('YES' if flg else 'NO')
main()


(n, m) = map(int, input().split())
cnts = [0] * (n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	cnts[a] += 1
	cnts[b] += 1
for c in cnts:
	if c % 2 == 1:
		print('NO')
		exit()
else:
	print('YES')


(n, m) = map(int, input().split())
cnt = [0 for _ in range(n)]
for _ in range(m):
	(a, b) = map(int, input().split())
	cnt[a - 1] += 1
	cnt[b - 1] += 1
for c in cnt:
	if c % 2:
		print('NO')
		quit()
print('YES')


(N, M) = map(int, input().split())
A = [list(map(int, input().split())) for i in range(M)]
(B, C) = zip(*A)
D = B + C
import collections
a = collections.Counter(D)
for i in a.values():
	if i % 2 == 1:
		print('NO')
		exit()
print('YES')


(N, M) = map(int, input().split())
cnt = [0] * N
for i in range(M):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	cnt[a] += 1
	cnt[b] += 1
for i in range(N):
	if cnt[i] % 2 != 0:
		print('NO')
		exit()
print('YES')


(N, M) = map(int, input().split())
AB = [0 for _ in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	AB[a - 1] += 1
	AB[b - 1] += 1
for i in range(N):
	if AB[i] % 2 or AB[i] % 2:
		print('NO')
		exit()
print('YES')


from collections import defaultdict as d
(N, M) = map(int, input().split())
E = d(int)
for i in range(M):
	(a, b) = map(int, input().split())
	E[a] ^= 1
	E[b] ^= 1
print(('YES', 'NO')[max(E.values())])


(n, m) = map(int, input().split())
nm = [list(map(int, input().split())) for _ in range(m)]
cnt = [0] * n
for (n, m) in nm:
	cnt[n - 1] += 1
	cnt[m - 1] += 1
if all([i % 2 == 0 for i in cnt]):
	print('YES')
else:
	print('NO')


from collections import Counter
(N, M) = map(int, input().split())
cnt = Counter((int(s) for _ in range(M) for s in input().split()))
if all((v % 2 == 0 for v in cnt.values())):
	print('YES')
else:
	print('NO')


(N, M) = map(int, input().split())
X = [0] * 10 ** 5
for i in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	X[a] += 1
	X[b] += 1
if all(map(lambda x: x % 2 == 0, X)):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
vs = [0] * (n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	vs[a] += 1
	vs[b] += 1
ans = 'YES'
for i in range(n + 1):
	if vs[i] % 2 == 1:
		ans = 'NO'
print(ans)


c = [0] * 10 ** 5
for i in open(0).read().split()[2:]:
	c[int(i) - 1] ^= 1
print('NO' if any(c) else 'YES')


(n, m) = map(int, input().split())
ab = [0] * n
for _ in range(m):
	(a, b) = (int(x) for x in input().split())
	ab[a - 1] += 1
	ab[b - 1] += 1
flag = False
for i in ab:
	if i % 2 == 1:
		flag = True
		break
if flag:
	print('NO')
else:
	print('YES')


from collections import Counter
(N, M) = map(int, input().split())
a = [0] * M
b = [0] * M
c = []
for i in range(M):
	(a[i], b[i]) = map(int, input().split())
	c.append(a[i])
	c.append(b[i])
d = dict(Counter(c))
ans = 'YES'
for e in d:
	if d[e] % 2 == 1:
		ans = 'NO'
print(ans)


(n, m) = map(int, input().split())
p = [0] * n
for i in range(m):
	(x, y) = map(int, input().split())
	p[x - 1] += 1
	p[y - 1] += 1
ans = 'YES'
for i in p:
	if i % 2 == 1:
		ans = 'NO'
print(ans)


(n, m) = map(int, input().split())
v = {}
for _ in range(m):
	(a, b) = map(int, input().split())
	v[a] = v.get(a, 0) + 1
	v[b] = v.get(b, 0) + 1
for (ki, vi) in v.items():
	if vi % 2 != 0:
		print('NO')
		break
else:
	print('YES')


def i1():
	return int(input())

def i2():
	return [int(i) for i in input().split()]
[n, m] = i2()
e = [0 for i in range(n + 1)]
for i in range(m):
	[a, b] = i2()
	e[a] += 1
	e[b] += 1
s = 'YES'
for i in range(1, n + 1):
	if e[i] % 2 == 1:
		s = 'NO'
print(s)


(N, M) = map(int, input().split())
K = [0] * 10 ** 5
for i in range(M):
	(P, Q) = map(int, input().split())
	K[P - 1] += 1
	K[Q - 1] += 1
flag = True
for i in range(10 ** 5):
	if K[i] % 2 != 0:
		flag = False
		break
if flag:
	print('YES')
else:
	print('NO')


(N, M) = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	G[a].append(b)
	G[b].append(a)
ans = 'NO' if any((len(g) % 2 for g in G)) else 'YES'
print(ans)


(N, M) = map(int, input().split())
L = [True] * (N + 1)
for i in range(M):
	(a, b) = map(int, input().split())
	L[a] = not L[a]
	L[b] = not L[b]
if False in L:
	print('NO')
else:
	print('YES')


from collections import Counter
(n, m) = map(int, input().split())
s = ''
for i in range(m):
	s = s + input()
counter = Counter(s)
for i in range(n + 1):
	if counter[str(i)] % 2 != 0:
		print('NO')
		break
if i == n:
	print('YES')


from collections import Counter
(N, M) = map(int, input().split())
li = []
for _ in range(M):
	(a, b) = map(int, input().split())
	li.append(a)
	li.append(b)
cli = Counter(li)
if all([v % 2 == 0 for (i, v) in cli.items()]):
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
cnt = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	cnt[a - 1] += 1
	cnt[b - 1] += 1
f = 1
for i in range(n):
	if cnt[i] % 2 != 0:
		f = 0
		break
print('YES' if f else 'NO')


(N, M) = map(int, input().split())
A = [0] * N
for i in range(M):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	A[a] = abs(1 - A[a])
	A[b] = abs(1 - A[b])
ans = 'YES'
for a in A:
	if a:
		ans = 'NO'
print(ans)


(N, M) = map(int, input().split(' '))
count = [0 for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split(' '))
	count[a - 1] += 1
	count[b - 1] += 1
if all([c % 2 == 0 for c in count]):
	print('YES')
else:
	print('NO')


(N, M) = (int(i) for i in input().split())
DP = [False] * N
for i in range(M):
	(a, b) = (int(k) for k in input().split())
	for j in (a, b):
		DP[j - 1] = not DP[j - 1]
for i in range(N):
	if DP[i]:
		print('NO')
		break
else:
	print('YES')


(n, m) = map(int, input().split())
l = [0] * (n + 1)
ku = []
for _ in range(m):
	ku.append(tuple(map(int, input().split())))
for x in ku:
	(a, b) = x
	l[a] = (l[a] + 1) % 2
	l[b] = (l[b] + 1) % 2
print('NO' if 1 in l else 'YES')


(n, m) = map(int, input().split())
d = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	d[a - 1] += 1
	d[b - 1] += 1
for x in d:
	if x % 2 == 1:
		print('NO')
		exit()
print('YES')


(N, M) = map(int, input().split())
deg = [0 for i in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	deg[a - 1] += 1
	deg[b - 1] += 1
res = 'YES'
for d in deg:
	if d % 2 == 1:
		res = 'NO'
print(res)


(n, m) = map(int, input().split())
d = {}
for i in range(m):
	for j in map(int, input().split()):
		d[j] = d.get(j, 0) + 1
if any((i % 2 for i in d.values())):
	print('NO')
else:
	print('YES')


from collections import defaultdict
(n, m) = map(int, input().split())
d = defaultdict(int)
for i in range(m):
	(a, b) = map(int, input().split())
	d[a] += 1
	d[b] += 1
for i in d:
	if d[i] % 2 == 1:
		print('NO')
		exit()
print('YES')


from itertools import accumulate as ac
(n, m) = map(int, input().split())
l = [0] * (n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	l[a] += 1
	l[b] -= 1
(*l,) = ac(l)
(*l,) = filter(lambda x: x % 2, l)
if l:
	print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
cnt = [0] * (n + 1)
for i in range(m):
	cnt[ab[i][0]] += 1
	cnt[ab[i][1]] += 1
flag = True
for i in range(1, n + 1):
	if cnt[i] % 2 != 0:
		flag = False
print('YES' if flag else 'NO')


(n, m) = map(int, input().split())
a = [0] * n
for i in range(m):
	(u, v) = map(int, input().split())
	a[u - 1] ^= 1
	a[v - 1] ^= 1
if sum(a):
	print('NO')
else:
	print('YES')


(n, m) = [int(w) for w in input().split()]
node = [0] * (n + 1)
for i in range(m):
	(a, b) = [int(w) for w in input().split()]
	node[a] ^= 1
	node[b] ^= 1
cond = all([w == 0 for w in node])
print('YES' if cond else 'NO')


from collections import Counter
(n, m) = map(int, input().split())
ab_input = [int(j) for i in range(m) for j in input().split()]
ab_count = Counter(ab_input)
if all((v % 2 == 0 for v in ab_count.values())):
	print('YES')
else:
	print('NO')


(N, M) = map(int, input().split())
A = [0] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	A[a] += 1
	A[b] += 1
if all([i % 2 == 0 for i in A]):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
a = [0] * n
for _ in range(m):
	(l, r) = map(int, input().split())
	a[l - 1] += 1
	a[r - 1] -= 1
for i in range(n - 1):
	a[i + 1] += a[i]
print(['YES', 'NO'][any([i % 2 for i in a])])


(N, M) = map(int, input().split())
X = [0] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	X[a - 1] ^= 1
	X[b - 1] ^= 1
print('YES' if sum(X) == 0 else 'NO')


(n, m) = map(int, input().split())
ki = [0] * (n + 1)
for i in range(m):
	(a, b) = map(int, input().split())
	ki[a] += 1
	ki[b] -= 1
cant = 0
for i in range(n):
	ki[i + 1] += ki[i]
	if ki[i + 1] % 2:
		cant = 1
print('YNEOS'[cant::2])


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
(N, M) = map(int, readline().split())
cnt = [0] * (N + 1)
for m in map(int, read().split()):
	cnt[m] += 1
print('YES' if all((c % 2 == 0 for c in cnt)) else 'NO')


(n, m) = [int(x) for x in input().split()]
cnt = [0] * (n + 1)
for i in range(m):
	(a, b) = [int(x) for x in input().split()]
	cnt[a] += 1
	cnt[b] += 1
for i in range(n):
	if cnt[i] % 2 == 1:
		print('NO')
		exit()
print('YES')


(N, M) = list(map(int, input().split()))
lis = [0 for i in range(N)]
for (a_i, b_i) in [map(int, input().split()) for _ in range(M)]:
	lis[a_i - 1] += 1
	lis[b_i - 1] += 1
for x in lis:
	if x % 2 == 1:
		print('NO')
		quit()
print('YES')


(n, m, *p) = map(int, open(0).read().split())
c = [0] * n
for x in p:
	c[x - 1] += 1
print('YNEOS'[any((x % 2 for x in c))::2])


(n, m) = map(int, input().split())
cnt = [0] * n
for i in range(m):
	(ai, bi) = map(int, input().split())
	ai -= 1
	bi -= 1
	cnt[ai] += 1
	cnt[bi] += 1
for i in range(n):
	if cnt[i] % 2:
		print('NO')
		exit()
print('YES')


from collections import Counter as C
(N, M, *A) = map(int, open(0).read().split())
print('YNEOS'[any((a & 1 for a in C(A).values()))::2])


from collections import Counter
(n, m) = [int(i) for i in input().split()]
a = []
for i in range(m):
	(s, e) = [int(i) for i in input().split()]
	a.append(s)
	a.append(e)
c = Counter(a)
for (i, j) in c.most_common():
	if j % 2 != 0:
		print('NO')
		break
else:
	print('YES')


(N, M) = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(M)]
nodes = [0] * (N + 1)
for (a, b) in AB:
	nodes[a] += 1
	nodes[b] += 1
for x in nodes:
	if x % 2:
		print('NO')
		exit()
print('YES')


(N, M) = [int(i) for i in input().split()]
q = [0] * N
for _ in range(M):
	(a, b) = [int(i) for i in input().split()]
	q[a - 1] += 1
	q[b - 1] += 1
for i in range(M):
	if q[i] % 2 != 0:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
li = [0] * (n + 1)
for i in range(m):
	(a, b) = map(int, input().split())
	li[a] += 1
	li[b] += 1
ans = 'YES' if all([x % 2 == 0 for x in li]) else 'NO'
print(ans)


(n, m) = map(int, input().split())
g = [0] * (n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	g[a] += 1
	g[b] += 1
	g[a] %= 2
	g[b] %= 2
print('YES' if 1 - max(g) else 'NO')


(n, m) = map(int, input().split())
d = {i: 0 for i in range(1, n + 1)}
for _ in range(m):
	(a, b) = map(int, input().split())
	d[a] += 1
	d[b] += 1
for (k, v) in d.items():
	if v % 2:
		print('NO')
		break
else:
	print('YES')


(n, _, *l) = map(int, open(0).read().split())
c = [0] * -~n
for (a, b) in zip(l[::2], l[1::2]):
	c[a] ^= 1
	c[b] ^= 1
print('YNEOS'[any((i for i in c))::2])


(n, m) = map(int, input().split())
l = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	l[a - 1] += 1
	l[b - 1] += 1
x = 'YES'
for i in l:
	if i % 2:
		x = 'NO'
		break
print(x)


(n, m) = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
s = [0] * (10 ** 5 + 1)
for (a, b) in ab:
	s[a] += 1
	s[b] += 1
if any([i % 2 for i in s]):
	print('NO')
else:
	print('YES')


(N, M) = map(int, input().split())
V = [0] * (N + 1)
for i in range(M):
	(a, b) = map(int, input().split())
	V[a] += 1
	V[b] += 1
bool = True
for i in range(N + 1):
	if V[i] % 2 == 1:
		bool = False
		break
if bool:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
l = [0] * (n + 1)
for i in range(m):
	(a, b) = [int(j) for j in input().split()]
	l[a] = (l[a] + 1) % 2
	l[b] = (l[b] + 1) % 2
if sum(l) == 0:
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
(n, m) = map(int, input().split())
A = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	A[a] ^= 1
	A[b] ^= 1
print('NO' if any(A) else 'YES')


(a, b) = map(int, input().split(' '))
ar = [0 for i in range(a)]
for i in range(b):
	(c, d) = map(int, input().split(' '))
	ar[c - 1] += 1
	ar[d - 1] += 1
for r in ar:
	if r % 2 == 1:
		print('NO')
		exit()
print('YES')


from collections import Counter
(N, M) = map(int, input().split())
cnt = Counter()
for _ in range(M):
	(a, b) = map(int, input().split())
	cnt[a] += 1
	cnt[b] += 1
print('YES' if all((x % 2 == 0 for x in cnt.values())) else 'NO')


import sys
(n, m) = map(int, input().split())
ctl = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	ctl[a - 1] += 1
	ctl[b - 1] += 1
for i in range(n):
	if ctl[i] % 2 == 1:
		print('NO')
		sys.exit()
print('YES')


(N, M) = map(int, input().split())
edge = [list(map(int, input().split())) for i in range(M)]
c = [[] for i in range(N)]
for (i, j) in edge:
	c[i - 1].append(j - 1)
	c[j - 1].append(i - 1)
print(['NO', 'YES'][all([len(ci) % 2 == 0 for ci in c])])


(n, m) = map(int, input().split())
l = [0] * (n + 1)
for i in range(m):
	(a, s) = map(int, input().split())
	l[a] += 1
	l[s] += 1
for i in l:
	if i % 2:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
c = [0] * n
for i in range(m):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	c[a] += 1
	c[b] += 1
ans = 'YES'
for i in c:
	if i % 2 == 1:
		ans = 'NO'
print(ans)


(N, M, *ab) = map(int, open(0).read().split())
ans = [0] * N
for (a, b) in zip(*[iter(ab)] * 2):
	ans[a - 1] += 1
	ans[b - 1] -= 1
print('NO') if any((a % 2 for a in ans)) else print('YES')


(N, M) = map(int, input().split())
D = {i: 0 for i in range(1, N + 1)}
for i in range(M):
	(a, b) = map(int, input().split())
	D[a] += 1
	D[b] += 1
p = 0
for i in D:
	if D[i] % 2 == 1:
		p = 1
if p == 0:
	print('YES')
else:
	print('NO')


(N, M) = map(int, input().split())
num = [0] * (N + 1)
for i in range(M):
	(a, b) = map(int, input().split())
	num[a] += 1
	num[b] += 1
flag = 1
for i in num:
	if i % 2 != 0:
		flag = 0
if flag == 1:
	print('YES')
else:
	print('NO')


from collections import defaultdict
(N, M) = map(int, input().split())
d = defaultdict(int)
for _ in range(M):
	(a, b) = map(int, input().split())
	d[a] += 1
	d[b] += 1
for (k, v) in d.items():
	if v % 2 != 0:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
res = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	res[a - 1] += 1
	res[b - 1] += 1
for e in res:
	if e % 2:
		print('NO')
		exit()
else:
	print('YES')


(N, M) = map(int, input().split())
C = [0] * N
for k in range(M):
	(a, b) = map(int, input().split())
	C[a - 1] += 1
	C[b - 1] += 1
for e in C:
	if e % 2 != 0:
		print('NO')
		exit(0)
print('YES')


(n, m) = map(int, input().split())
d = dict()
for i in range(1, n + 1):
	d[i] = 0
for _ in range(m):
	a = map(int, input().split())
	for x in a:
		d[x] += 1
		d[x] %= 2
if any(d.values()):
	print('NO')
else:
	print('YES')


from collections import Counter
from itertools import chain
(n, m) = map(int, input().split())
c = Counter(chain.from_iterable((map(int, input().split()) for _ in range(m))))
print('NO' if any((i % 2 for i in c.values())) else 'YES')


import sys
from collections import Counter
read = sys.stdin.read
(N, M, *ab) = map(int, read().split())
answer = [1 for i in Counter(ab).values() if i % 2 == 1]
if not answer:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
che = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	che[a - 1] += 1
	che[b - 1] += 1
error = 0
for i in range(n):
	if che[i] % 2 != 0:
		error += 1
if error == 0:
	print('YES')
else:
	print('NO')


(N, M) = map(int, input().split())
NL = [0 for i in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	NL[a - 1] += 1
	NL[b - 1] += 1
flg = True
for i in range(N):
	if NL[i] % 2 == 1:
		flg = False
if flg:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
d = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	d[a - 1] ^= 1
	d[b - 1] ^= 1
ans = 0
for j in range(n):
	ans |= d[j]
if ans:
	print('NO')
else:
	print('YES')


import sys
input = sys.stdin.readline
(N, M) = map(int, input().split())
cnt = [0] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	cnt[a - 1] += 1
	cnt[b - 1] += 1
for i in range(N):
	if cnt[i] % 2 == 1:
		print('NO')
		exit()
print('YES')


(n, m) = (int(i) for i in input().split())
x = [0 for i in range(n)]
for _ in range(m):
	(a, b) = (int(i) - 1 for i in input().split())
	(x[a], x[b]) = (1 - x[a], 1 - x[b])
if sum(x):
	print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
A = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	A[a - 1] += 1
	A[b - 1] += 1
f = 0
for i in range(n):
	if A[i] % 2 == 1:
		f = 1
if f == 0:
	print('YES')
else:
	print('NO')


def main():
	(N, _, *A) = map(int, open(0).read().split())
	T = [0] * (N + 1)
	for i in A:
		T[i] += 1
	flg = all((i % 2 == 0 for i in T))
	print('YES' if flg else 'NO')
main()


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
a = [0] * (n + 1)
for _ in range(m):
	(x, y) = map(int, input().split())
	a[x] = a[x] + 1 & 1
	a[y] = a[y] + 1 & 1
print('YES' if sum(a) == 0 else 'NO')


(N, M) = map(int, input().split())
d = {}
for i in range(M):
	for i in [int(i) for i in input().split()]:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
for i in d.values():
	if i % 2:
		print('NO')
		break
else:
	print('YES')


(N, M) = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
U = [0] * (N + 2)
for (A, B) in AB:
	U[A + 1] += 1
	U[B + 1] -= 1
for u in U:
	if u % 2:
		print('NO')
		exit()
print('YES')


l = [0] * 2 ** 17
for i in open(0).read().split()[2:]:
	l[int(i)] += 1
print('YNEOS'[any((i % 2 for i in l))::2])


(N, M) = map(int, input().split())
e = [0] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	e[a - 1] += 1
	e[b - 1] += 1
if all((x % 2 == 0 for x in e)):
	print('YES')
else:
	print('NO')


from collections import defaultdict
(n, m) = map(int, input().split())
node = defaultdict(int)
ans = 'YES'
for i in range(m):
	(a, b) = map(int, input().split())
	node[a] += 1
	node[b] += 1
for i in node.items():
	if i[1] % 2 != 0:
		ans = 'NO'
print(ans)


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
ln = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	ln[a - 1] += 1
	ln[b - 1] += 1
for i in ln:
	if i % 2:
		print('NO')
		exit()
print('YES')


import sys
(N, M) = [int(i) for i in sys.stdin.readline().split()]
v = [0] * N
for _ in range(M):
	(a, b) = map(int, sys.stdin.readline().split())
	v[a - 1] ^= 1
	v[b - 1] ^= 1
print('NO' if 1 in v else 'YES')


(N, M) = map(int, input().split())
cnt = [True] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	cnt[a - 1] = not cnt[a - 1]
	cnt[b - 1] = not cnt[b - 1]
print('YES' if all(cnt) else 'NO')


(N, M) = map(int, input().split())
C = [0] * N
for i in range(M):
	(ai, bi) = map(int, input().split())
	C[ai - 1] += 1
	C[bi - 1] += 1
print('YES' if len(list(filter(lambda i: i % 2 == 1, C))) == 0 else 'NO')


(N, M) = map(int, input().split())
A = [0] * N
for _ in range(M):
	(x, y) = map(int, input().split())
	(x, y) = (x - 1, y - 1)
	A[x] += 1
	A[y] += 1
for a in A:
	if a % 2:
		print('NO')
		exit()
print('YES')