Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.
Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.

-----Constraints-----
 - x and y are integers.
 - 1 ≤ x < y ≤ 12

-----Input-----
Input is given from Standard Input in the following format:
x y

-----Output-----
If x and y belong to the same group, print Yes; otherwise, print No.

-----Sample Input-----
1 3

-----Sample Output-----
Yes

Difficulty: EASY

Solutions:
g = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
(a, b) = map(int, input().split())
print('Yes' if g[a - 1] == g[b - 1] else 'No')


(a, b) = list(map(int, input().split()))
s = {1, 3, 5, 8, 7, 10, 12}
t = {4, 6, 9, 11}
u = {2}
if a in s and b in s:
	print('Yes')
elif a in t and b in t:
	print('Yes')
elif a in u and b in u:
	print('Yes')
else:
	print('No')


a = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
(x, y) = map(int, input().split())
print('Yes') if a[x] == a[y] else print('No')


(x, y) = map(int, input().split())
a = [4, 6, 9, 11]
b = 0
c = 0
if x == 2 or y == 2:
	print('No')
else:
	if x in a:
		b = 1
	if y in a:
		c = 1
	if (b + c) % 2 == 0:
		print('Yes')
	else:
		print('No')


(x, y) = map(int, input().split())
group = [-1, 0, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 0]
print('Yes' if group[x] == group[y] else 'No')


c = [['1', '3', '5', '7', '8', '10', '12'], ['4', '6', '9', '11'], ['2']]
(a, b) = input().split(' ')
if a in c[0] and b in c[0]:
	print('Yes')
elif a in c[1] and b in c[1]:
	print('Yes')
elif a in c[2] and b in c[2]:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if x in a and y in a or (x in b and y in b) or (x in c and y in c):
	print('Yes')
else:
	print('No')


g = [3, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
(x, y) = list(map(int, input().split()))
if g[x] == g[y]:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
arr = [0, 3, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
if arr[x - 1] == arr[y - 1]:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
t = [0] * 13
t[4] = t[6] = t[9] = t[11] = 1
t[2] = 2
print('Yes' if t[x] == t[y] else 'No')


(x, y) = list(map(int, input().split()))
s = [1, 3, 5, 7, 8, 10, 12]
s1 = [4, 6, 9, 11]
s2 = [2]
if x in s:
	if y in s:
		print('Yes')
		return
elif x in s1:
	if y in s1:
		print('Yes')
		return
elif x in s2:
	if y in s2:
		print('Yes')
		return
print('No')


(x, y) = [int(x) for x in input().split()]
li = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
if li[x - 1] == li[y - 1]:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
L = [4, 6, 9, 11] * 2 + [2]
print(['No', 'Yes'][L.count(a) == L.count(b)])


G1 = [1, 3, 5, 7, 8, 10, 12]
G2 = [4, 6, 9, 11]
(x, y) = map(int, input().split())
if x in G1 and y in G1:
	print('Yes')
elif x in G2 and y in G2:
	print('Yes')
else:
	print('No')


A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
(x, y) = map(int, input().split())
print('Yes' if x in A and y in A or (x in B and y in B) else 'No')


(x, y) = map(int, input().split())
group = 'acababaababa'
print('Yes' if group[x - 1] == group[y - 1] else 'No')


s = '0121313113131'
(x, y) = map(int, input().split())
print('YNeos'[s[x] != s[y]::2])


(a, b) = map(int, input().split())
c = [0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
print(['No', 'Yes'][c[a] == c[b]])


(x, y) = map(int, input().split())
a = [1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
print(['No', 'Yes'][a[x - 1] == a[y - 1]])


group = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
(x, y) = map(int, open(0).readline().split())
print('Yes' if group[x - 1] == group[y - 1] else 'No')


(x, y) = list(map(int, input().split()))
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]
if x in g1 and y in g1:
	print('Yes')
elif x in g2 and y in g2:
	print('Yes')
elif x in g3 and y in g3:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
Group = [1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1]
print('Yes' if Group[x - 1] == Group[y - 1] else 'No')


n = '0123456789abc'
g = 'xacababaababa'
(x, y) = map(int, input().split())
print('Yes' if g[x] == g[y] else 'No')


(a, b) = [int(x) for x in input().split()]
g = [[] for x in range(3)]
g[0] = [1, 3, 5, 7, 8, 10, 12]
g[1] = [4, 6, 9, 11]
g[2] = [2]
res = 'No'
for i in range(3):
	if a in g[i] and b in g[i]:
		res = 'Yes'
print(res)


l = set(map(int, input().split()))
print('Yes' if l <= set([1, 3, 5, 7, 8, 10, 12]) or l <= set([4, 6, 9, 11]) else 'No')


g = [None, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
(x, y) = map(int, input().split())
print('Yes' if g[x] == g[y] else 'No')


(x, y) = map(int, input().split())
g = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
s = 0
for i in range(3):
	if x in g[i] and y in g[i]:
		print('Yes')
		s = 1
if s == 0:
	print('No')


m = [1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
(a, b) = map(int, input().split())
if m[a - 1] == m[b - 1]:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
A = set([1, 3, 5, 7, 8, 10, 12])
B = set([4, 6, 9, 11])
if x in A and y in A:
	print('Yes')
elif x in B and y in B:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
if {x, y} <= {1, 3, 5, 7, 8, 10, 12} or {x, y} <= {4, 6, 9, 11}:
	print('Yes')
else:
	print('No')


S = 'XABACACAACACA'
(a, b) = map(int, input().split())
print('Yes' if S[a] == S[b] else 'No')


i = set(map(int, input().split()))
a = {1, 3, 5, 7, 8, 10, 12}
b = {4, 6, 9, 11}
c = {2}
print(['No', 'Yes'][i <= a or i <= b or i <= c])


a = [0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1]
(x, y) = (int(x) for x in input().split())
if a[x] == a[y]:
	print('Yes')
else:
	print('No')


S = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
(a, b) = [int(x) for x in input().split()]
if S[a - 1] == S[b - 1]:
	print('Yes')
else:
	print('No')


xy = {int(i) for i in input().split()}
A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
C = {2}
print('Yes' if xy < A or xy < B or xy < C else 'No')


a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = list(map(int, input().split(' ')))
print('Yes') if c[0] in a and c[1] in a or (c[0] in b and c[1] in b) else print('No')


(x, y) = map(int, input().split())
a = [x, ~y, x, y, x, y, x, x, y, x, y, x]
print(['No', 'Yes'][a[~-x] == a[~-y]])


S = 'ACABABAABABA'
(a, b) = map(int, input().split())
print('Yes' if S[a - 1] == S[b - 1] else 'No')


(x, y) = list(map(int, input().split()))
for l in [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]:
	if x in l and y in l:
		print('Yes')
		return
print('No')


array1 = [1, 3, 5, 7, 8, 10, 12]
array2 = [4, 6, 9, 11]
array3 = [2]
(x, y) = map(int, input().split())
if x in array1 and y in array1 or (x in array2 and y in array2) or (x in array3 and y in array3):
	print('Yes')
else:
	print('No')


group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
(x, y) = map(int, input().split())
if x in group1 and y in group1 or (x in group2 and y in group2) or x == y == 2:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
if a == 4 or a == 6 or a == 9 or (a == 11):
	if b == 1 or b == 2 or b == 3 or (b == 5) or (b == 7) or (b == 8) or (b == 10) or (b == 12):
		print('No')
	else:
		print('Yes')
elif a == 2:
	print('No')
elif b == 2 or b == 4 or b == 6 or (b == 9) or (b == 11):
	print('No')
else:
	print('Yes')


s = 'xacababaababa'
(x, y) = map(int, input().split())
print('Yes' if s[x] == s[y] else 'No')


(x, y) = map(int, input().split())
L = [0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
print(['No', 'Yes'][L[x] == L[y]])


A = '020101001010'
(a, b) = map(int, input().split())
if A[a - 1] == A[b - 1]:
	print('Yes')
else:
	print('No')


gr = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
(x, y) = map(int, input().split())
ans = 'Yes' if gr[x] == gr[y] else 'No'
print(ans)


(X, Y) = map(int, input().split())
A = (1, 3, 5, 7, 8, 10, 12)
B = (4, 6, 9, 11)
C = 2
ans = 'No'
if X in A and Y in A:
	ans = 'Yes'
elif X in B and Y in B:
	ans = 'Yes'
elif X == Y == 2:
	ans = 'Yes'
print(ans)


print(' YNeos'[len(set([2 if i in [2] else 1 if i in [4, 6, 9, 11] else 0 for i in list(map(int, input().split()))]))::2])


S = 'XACABABAABABA'
(x, y) = map(int, input().split())
print('Yes' if S[x] == S[y] else 'No')


print(['', 'Yes', 'No'][len(set(('XACABABAABABA'[int(x)] for x in input().split())))])


g1 = [4, 6, 9, 11]
g2 = [2]
(x, y) = list(map(int, input().split()))
gx = 1 if x in g1 else 2 if x in g2 else 0
gy = 1 if y in g1 else 2 if y in g2 else 0
print('Yes' if gx == gy else 'No')


(x, y) = map(int, input().split())
group = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
print(['No', 'Yes'][group[x] == group[y]])


(x, y) = map(int, input().split())
G = '121313113131'
print(['No', 'Yes'][G[x - 1] == G[y - 1]])


g = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
(x, y) = map(int, input().split())
print('YNeos'[g[x] != g[y]::2])


g = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
(x, y) = [int(i) for i in input().split()]
if g[x] == g[y]:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = [1, 3, 5, 7, 8, 10, 12]
p = [4, 6, 9, 11]
print('Yes' if a in s and b in s or (a in p and b in p) else 'No')


print(['No', 'Yes'][(lambda a, b: a[b[0] - 1] == a[b[1] - 1])([0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0], list(map(int, input().split())))])


s = 'nACABABAABABA'
(a, b) = map(int, input().split())
if s[a] == s[b]:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
gr1 = [1, 3, 5, 7, 8, 10, 12]
gr2 = [4, 6, 9, 11]
gr3 = [2]
if x in gr1 and y in gr1:
	print('Yes')
elif x in gr2 and y in gr2:
	print('Yes')
elif x in gr3 and y in gr3:
	print('Yes')
else:
	print('No')


g0 = {1, 3, 5, 7, 8, 10, 12}
g1 = {4, 6, 9, 11}
s = set(map(int, input().split()))
print('Yes' if s < g0 or s < g1 else 'No')


dirs = [{1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}]
i = list(map(int, input().split()))
for dir in dirs:
	if i[0] in dir and i[1] in dir:
		print('Yes')
		return
else:
	print('No')


A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
x = set(map(int, input().split()))
print('Yes' if x <= A or x <= B else 'No')


(a, b) = map(int, input().split())
l = [1, 3, 5, 7, 8, 10, 12]
if a == 2 or b == 2:
	print('No')
elif int(a in l) == int(b in l):
	print('Yes')
else:
	print('No')


group = '0020101001010'
(x, y) = map(int, input().split())
print('Yes' if group[x] == group[y] else 'No')


(a, b) = list(map(int, input().split()))
lis = [4, 6, 9, 11]
lis2 = [1, 3, 5, 7, 8, 10, 12]
if a == b == 2:
	print('Yes')
elif a in lis and b in lis:
	print('Yes')
elif a in lis2 and b in lis2:
	print('Yes')
else:
	print('No')


a = map(int, input().split())
input_set = set(a)
group_a = {1, 3, 5, 7, 8, 10, 12}
group_b = {4, 6, 9, 11}
group_c = {2}
list_of_list = [group_a, group_b, group_c]
count_match = 0
for set_i in list_of_list:
	if set_i.issuperset(input_set):
		count_match += 1
		print('Yes')
		break
if not count_match >= 1:
	print('No')


(a, b) = map(int, input().split())
num = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
if num[a] == num[b]:
	print('Yes')
else:
	print('No')


G = [set([1, 3, 5, 7, 8, 10, 12]), set([4, 6, 9, 11]), set([2])]

def check(x, y):
	for g in G:
		if x in g and y in g:
			return True
	return False
(x, y) = list(map(int, input().split()))
print('Yes' if check(x, y) else 'No')


(x, y) = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
if x in A and y in A:
	check = True
elif x in B and y in B:
	check = True
elif x in C and y in C:
	check = True
else:
	check = False
print('Yes' if check else 'No')


k = [1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
(N, M) = map(int, input().split())
if k[N - 1] == k[M - 1]:
	print('Yes')
else:
	print('No')


a = [{1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}]
s = set(map(int, input().split()))
print('Yes' if any((s <= x for x in a)) else 'No')


(x, y) = map(int, input().split())
S1 = [1, 3, 5, 7, 8, 10, 12]
S2 = [4, 6, 9, 11]
ans = False
for i in range(len(S1)):
	for j in range(len(S1)):
		if S1[i] == x and S1[j] == y:
			ans = True
for i in range(len(S2)):
	for j in range(len(S2)):
		if S2[i] == x and S2[j] == y:
			ans = True
if ans:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
gr_a = [1, 3, 5, 7, 8, 10, 12]
gr_b = [4, 6, 9, 11]
gr_c = [2]
if x in gr_a and y in gr_a:
	print('Yes')
elif x in gr_b and y in gr_b:
	print('Yes')
else:
	print('No')


s1 = set([1, 3, 5, 7, 8, 10, 12])
s2 = set([4, 6, 9, 11])
s3 = set([2])
(a, b) = map(int, input().split())
for i in [s1, s2, s3]:
	if a in i and b in i:
		print('Yes')
		break
else:
	print('No')


g = ' ACABABAABABA'
(x, y) = map(int, input().split())
print('Yes' if g[x] == g[y] else 'No')


(x, y) = map(int, input().split())
a = [4, 6, 9, 11]
b = [1, 3, 5, 7, 8, 10, 12]
print(['No', 'Yes'][int(x in a) * (y in a) + int(x in b) * (y in b)])


g = 'XACABABAABABA'
(x, y) = map(int, input().split())
print(['No', 'Yes'][g[x] == g[y]])


(x, y) = map(int, input().split())
g = [4, 6, 9, 11]
if x == 2 or y == 2:
	print('No')
elif (x in g) ^ (y in g):
	print('No')
else:
	print('Yes')


(x, y) = map(int, input().split())
l = [4, 6, 9, 11]
print('YNeos'[(x in l) ^ (y in l) | (2 in (x, y))::2])


a = map(int, input().split())
input_list = list(a)
group_a = [1, 3, 5, 7, 8, 10, 12]
group_b = [4, 6, 9, 11]
group_c = [2]
list_of_list = [group_a, group_b, group_c]
count_match = 0
for list_i in list_of_list:
	if input_list[0] in list_i and input_list[1] in list_i:
		count_match += 1
		break
if count_match == 1:
	print('Yes')
else:
	print('No')


lst1 = [4, 6, 9, 11]
lst2 = [2]
lst3 = [1, 3, 5, 7, 8, 10, 12]
(x, y) = map(int, input().split())
if x in lst1 and y in lst1:
	print('Yes')
elif x in lst2 and y in lst2:
	print('Yes')
elif x in lst3 and y in lst3:
	print('Yes')
else:
	print('No')


s = 'acababaababa'
(a, b) = map(int, input().split())
print('Yes' if s[a - 1] == s[b - 1] else 'No')


(a, b) = input().split()
a = int(a)
b = int(b)
l1 = [1, 3, 5, 7, 8, 10, 12]
l2 = [4, 6, 9, 11]
if a in l1 and b in l1:
	print('Yes')
elif a in l2 and b in l2:
	print('Yes')
else:
	print('No')


s = set(map(int, input().split()))
print(' YNeos'[s < {1, 3, 5, 7, 8, 10, 12} or {4, 6, 9, 11} > s::2])


A = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
(X, Y) = map(int, input().split())
print('Yes' if A[X - 1] == A[Y - 1] else 'No')


(a, b) = map(int, input().split())
L = [1, 3, 5, 7, 8, 10, 12] * 3 + [4, 6, 9, 11] * 2 + [2]
print(['No', 'Yes'][L.count(a) == L.count(b)])


s = [int(i) for i in input().split()]
f = lambda x, l: not set(x) - set(l)
print(['No', 'Yes'][f(s, [1, 3, 5, 7, 8, 10, 12]) or f(s, [4, 6, 9, 11]) or f(s, [2])])


l = {4, 6, 9, 11}
m = set(range(13)) - l - {2}
A = set(map(int, input().split()))
print('YNeos'[A & l != A and A & m != A::2])


(x, y) = map(int, input().split())
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
flag = False
if x in group1 and y in group1:
	flag = True
elif x in group2 and y in group2:
	flag = True
if flag:
	print('Yes')
else:
	print('No')


p = '_acababaababa'
(x, y) = map(int, input().split())
print('YNeos'[p[x] != p[y]::2])


(x, y) = map(int, input().split())
grp = [0] * 13
grp[2] = 1
for i in [4, 6, 9, 11]:
	grp[i] = 2
print('Yes' if grp[x] == grp[y] else 'No')


N = 12
Parent = [I for I in range(N + 1)]
Rank = [0] * (N + 1)

def FindParent(X):
	if Parent[X] == X:
		return X
	else:
		Parent[X] = FindParent(Parent[X])
		return Parent[X]

def CheckParent(X, Y):
	return FindParent(X) == FindParent(Y)

def UniteParent(X, Y):
	X = FindParent(X)
	Y = FindParent(Y)
	if X == Y:
		return 0
	if Rank[X] < Rank[Y]:
		Parent[X] = Y
	else:
		Parent[Y] = X
		if Rank[X] == Rank[Y]:
			Rank[X] += 1
for GA in [3, 5, 7, 8, 10, 12]:
	UniteParent(1, GA)
for GB in [6, 9, 11]:
	UniteParent(4, GB)
(X, Y) = (int(T) for T in input().split())
print(['No', 'Yes'][CheckParent(X, Y)])


(x, y) = map(int, input().split())
s1 = [1, 3, 5, 7, 8, 10, 12]
s2 = [4, 6, 9, 11]
s3 = [2]
if x in s1 and y in s1:
	print('Yes')
elif x in s2 and y in s2:
	print('Yes')
elif x in s3 and y in s3:
	print('Yes')
else:
	print('No')


g = 'ACABABAABABA'
(x, y) = map(int, input().split())
print('YNeos'[g[x - 1] != g[y - 1]::2])


S = 'ACABABAABABA'
(x, y) = map(int, input().split())
print('Yes' if S[x - 1] == S[y - 1] else 'No')


(x, y) = map(int, input().split())
a = [4, 6, 9, 11]
print('Yes' if x != 2 and y != 2 and (x in a and y in a or (x not in a and y not in a)) else 'No')


lisa = [1, 3, 5, 7, 8, 10, 12]
lisb = [4, 6, 9, 11]
lisc = [2]
(x, y) = map(int, input().split())
if x in lisa and y in lisa:
	print('Yes')
elif x in lisb and y in lisb:
	print('Yes')
elif x in lisc and y in lisc:
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
s1 = {1, 3, 5, 7, 8, 10, 12}
s2 = {4, 6, 9, 11}
print(['No', 'Yes'][x in s1 and y in s1 or (x in s2 and y in s2)])


import sys, math
from itertools import combinations as c, product as p
from collections import deque
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def si():
	return input()

def ii():
	return int(input())

def fi():
	return float(input())

def lstr():
	return input().split()

def lint():
	return list(map(int, input().split()))

def lintdec():
	return list(map(lambda x: int(x) - 1, input().split()))

def lnstr(n):
	return [input() for _ in range(n)]

def lnint(n):
	return [int(input()) for _ in range(n)]

def lint_list(n):
	return [lint() for _ in range(n)]
c = set(lint())
a = set([1, 3, 5, 7, 8, 10, 12])
b = set([4, 6, 9, 11])
if c & a == c or c & b == c:
	print('Yes')
else:
	print('No')


(x, y) = list(map(int, input().split()))
ga = [4, 6, 9, 11]
gb = [1, 3, 5, 7, 8, 10, 12]
gc = [2]
xg = yg = ''

def group(x):
	if x in ga:
		return 'ga'
	if x in gb:
		return 'gb'
	if x in gc:
		return 'gc'
xg = group(x)
yg = group(y)
if xg == yg:
	print('Yes')
else:
	print('No')


lst = input().split()
x = int(lst[0])
y = int(lst[1])
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]

def judge(L):
	if x in L and y in L:
		return True
	else:
		return False
if judge(A) or judge(B) or judge(C):
	print('Yes')
else:
	print('No')