Problem:
 Score : 100 points    Problem Statement 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 1 3      Sample Output 1 Yes       Sample Input 2 2 4      Sample Output 2 No

Solution (Python):
x, y = tuple(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")

Solution (Python):
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    d = collections.defaultdict(list)
    d[1] += [0]
    d[3] += [0]
    d[5] += [0]
    d[7] += [0]
    d[8] += [0]
    d[10] += [0]
    d[12] += [0]
    d[4] += [1]
    d[6] += [1]
    d[9] += [1]
    d[11] += [1]
    d[2] += [2]
    x, y = list(map(int, input().rstrip('\n').split()))
    print("Yes" if d[x] == d[y] else "No")


if __name__ == '__main__':
    slove()

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

Solution (Python):
x, y = map(int, input().split())
group2 = [4,6,9,11]
group3 = [2]
if x in group2 and y in group2:
    print("Yes")
elif x not in group2 and x not in group3 and y not in group2 and y not in group3:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Solution (Python):
x,y=map(int,input().split())

A=[1,3,5,7,8,10,12]
B=[4,6,9,11]

if x==2 and y==2:
  print('Yes')
elif x in A and y in A:
  print('Yes')
elif x in B and y in B:
  print('Yes')
else:
  print('No')

Solution (Python):
x,y=map(int,input().split())

A=[1,3,5,7,8,10,12]
B=[4,6,9,11]

if x==2 and y==2:
  print('Yes')
elif x in A and y in A:
  print('Yes')
elif x in B and y in B:
  print('Yes')
else:
  print('No')

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

Solution (Python):
x,y=input().split()
a={"1","3","5","7","8","10","12"}
b={"4","6","9","11"}
print("Yes" if {x,y}<=a or {x,y}<=b else "No")

Solution (Python):
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x,y = map(int,input().split())
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")

Solution (Python):
g = [
  [1,3,5,7,8,10,12],
  [4,6,9,11],
  [2]
  ]

def get_group(n):
  for i, gg in enumerate(g):
    if n in gg:
      return i


x, y = list(map(int, input().split()))

if get_group(x) == get_group(y):
  print('Yes')
else:
  print('No')

Solution (Python):
x, y = map(int, input().split())
group1 = [4, 6, 9, 11]
group2 = [1, 3, 5, 7, 8, 10, 12]

if x == y == 2:
    print('Yes')
elif x in group1 and y in group1:
    print('Yes')
elif x in group2 and y in group2:
    print('Yes')
else:
    print('No')

Solution (Python):
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

x, y = map(int, input().split())

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')

Solution (Python):
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

i, j = map(int, input().split())

l = [a, b, c]
for d in l:
  if i in d:
    if j in d:
      print("Yes")
      quit()
    else:
      print("No")
      quit()

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

Solution (Python):
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')

Solution (Python):


x, y = map(int, input().split())

CLASS_A = [1,3,5,7,8,10,12]
CLASS_B = [4,6,9,11]
CLASS_C = [2]

if x in CLASS_A:
    class_x = "A"
elif x in CLASS_B:
    class_x = "B"
else:
    class_x = "C"

if y in CLASS_A:
    class_y = "A"
elif y in CLASS_B:
    class_y = "B"
else:
    class_y = "C"

if class_x == class_y:
    print("Yes")
else:
    print("No")

Solution (Python):
def same_check(a,b,c):
    if a in c and b in c:
        return True
    else:
        return False

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

if __name__ == '__main__':
    main()

Solution (Python):
a, b = map(int, input().split())
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]
if a in g1  and b in g1:
  print("Yes")
elif a in g2  and b in g2:
  print("Yes")
elif a in g3  and b in g3:
  print("Yes")
else:
  print("No")

Solution (Python):
a,b = list(map(int, input().split()))

if(a in {1,3,5,7,8,10,12} and b in {1,3,5,7,8,10,12}):
  print("Yes")
  exit()
if(a in {4,6,9,11} and b in {4,6,9,11}):
  print("Yes")
  exit()
if(a in {2} and b in {2}):
  print("Yes")
  exit()
print("No")

Solution (Python):
a = {1,3,5,7,8,10,12}
b = {4,6,9,11}
c = {2,}
x, y = map(int,input().split())
giv = {x,y}
if giv <= a or giv <= b or giv <= c:
  print("Yes")
else:
  print("No")

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a=[1,3,5,7,8,10,12]
    b=[4,6,9,11]
    c=[2]
    x,y = INTM()
    if x in a:
        d = 21
    elif x in b:
        d = 22
    elif x==2:
        d = 23
    
    if y in a:
        f = 21
    elif y in b:
        f = 22
    elif y==2:
        f = 23
    
    if d==f:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

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

Solution (Python):
group_a = [1, 3, 5, 7, 8, 10, 12]
group_b = [4, 6, 9, 11]
group_c = [2]

x, y = map(int, input().split())
if x in group_a and y in group_a:
    print('Yes')
elif x in group_b and y in group_b:
    print('Yes')
elif x in group_c and y in group_c:
    print('Yes')
else:
    print('No')

Solution (Python):



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


if group[x] == group[y]:
  print('Yes')
else:
  print('No')

Solution (Python):
x,y = 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')
else:
    print('No')

Solution (Python):
x, y = map(int, input().split())
if x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12:
  x_group = "A"
elif x == 4 or x == 6 or x == 9 or x == 11:
  x_group = "B"
else:
  x_group = "C"
if y == 1 or y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
  y_group = "A"
elif y == 4 or y == 6 or y == 9 or y == 11:
  y_group = "B"
else:
  y_group = "C"
if x_group == y_group:
  print("Yes")
else:
  print("No")

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

Solution (Python):
x,y = 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")

Solution (Python):



def main():

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






if __name__ == "__main__":
    main()

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

Solution (Python):
a = (1,3,5,7,8,10,12)
b = (4,6,9,11)
c = (2,)
abc = [a,b,c]
x,y = map(int,input().split())
for i, checker in enumerate(abc):
    if x in checker:
        checker2 = checker
if y in checker2:
    print("Yes")
else:
    print("No")

Solution (Python):
a = (1,3,5,7,8,10,12)
b = (4,6,9,11)
c = set([2])
abc = [a,b,c]
x,y = map(int,input().split())
for i, checker in enumerate(abc):
    if x in checker:
        checker2 = checker
if y in checker2:
    print("Yes")
else:
    print("No")

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

Solution (Python):
import sys


		
def main():
	x,y = map(int, input().split())
	g1=[1,3,5,7,8,10,12]
	g2=[4,6,9,11]
	g3=[2]
	gll=[g1,g2,g3]
	for g in gll:
		if x in g and y in g:
			return 'Yes'
	return 'No'
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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

Solution (Python):
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")

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

Solution (Python):
x,y = map(int, input().split())

group1 = [1,3,5,7,8,10,12]
group2 = [4,6,9,11]
group3 = [2]

if ((x in group1 and y in group1) or
   (x in group2 and y in group2) or
   (x in group3 and y in group3)):
      print('Yes')
else:
  print('No')

Solution (Python):
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]

x, y = map(int, input().split())

if x in group1:
    if y in group1:
        print('Yes')
    else:
        print('No')

if x in group2:
    if y in group2:
        print('Yes')
    else:
        print('No')

if x in group3:
    if y in group3:
        print('Yes')
    else:
        print('No')

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

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")

Solution (Python):
def resolve():
    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")


if __name__ == "__main__":
    resolve()

Solution (Python):
a,b=map(int,input().split())

def ans(n):
    a=[1,3,5,7,8,10,12]
    b=[4,6,9,11]
    c=[2]
    
    if n in a:
        return 0
    if n in b:
        return 1
    if n in c:
        return 2
if ans(a)==ans(b):
    print('Yes')
else:
    print('No')

Solution (Python):
x, y = 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')

Solution (Python):
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
x, y = list(map(int, input().split()))
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")

Solution (Python):

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

x, y = list(map(int,input().split()))
if ((x in a) and (y in a)): print("Yes")
elif ((x in b) and (y in b)): print("Yes")
elif ((x in c) and (y in c)): print("Yes")
else: print("No")

Solution (Python):
s=list(input().split())
a=int(s[0])
b=int(s[1])
grA=[1,3,5,7,8,10,12]
grB=[4,6,9,11]
grC=[2]
if a in grA:
  if b in grA:
    print('Yes')
  else:
    print('No')
elif a in grB:
  if b in grB:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Solution (Python):
x, y = map(int, input().split())

first_group = [1, 3, 5, 7, 8, 10, 12]
second_group = [4, 6, 9, 11]

if x == 2 or y == 2:
    print('No')
elif x in first_group and y in second_group:
    print('No')
elif x in second_group and y in first_group:
    print('No')
else:
    print('Yes')

Solution (Python):
x, y = map(int, input().split())
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]

ans = "No"
if x in A and y in A:
    ans = "Yes"
elif x in B and y in B:
    ans = "Yes"
print(ans)

Solution (Python):
x, y = map(int, input().split())
if x == 2 or y == 2:
  print("No")
elif {4, 6, 9} >= {x} and {6, 9, 11} >= {y}:
  print("Yes")
elif {1, 3, 5, 7, 8, 10} >= {x} and {3, 5, 7, 8, 10, 12} >= {y}:
  print("Yes")
else :
  print("No")

Solution (Python):
x,y = map(int,input().split())
A = [0,1,2,1,3,1,3,1,1,3,1,3,1]
if A[x]==A[y]:
    print("Yes")
else:
    print("No")

Solution (Python):
group_target = set(map(int, input().split()))

groupa = {1, 3, 5, 7, 8, 9, 10, 12}
groupb = {4, 6, 9, 11}
groupc = {2}

if group_target.issubset(groupa) or group_target.issubset(groupb):
    print("Yes")
else:
    print("No")

Solution (Python):
d= dict(zip(range(1,13),[0,2,0,1,0,1,0,0,1,0,1,0]))
x,y = [int(x) for x in input().split()]
print("Yes" if d[x]==d[y] else "No")

Solution (Python):
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x,y = map(int,input().split())

if (x in a) and (y in a):
    print("Yes")
elif (x in b) and (y in b):
    print("Yes")
elif (x in c) and (y in c):
    print("Yes") 
else:
    print("No")

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

Solution (Python):
print(["Yes","No"][input().count("2")])

Solution (Python):
a = [1,3, 5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x, y = map(int,input().split())
ans = []

for i in a,b:
    if x in i and y in i:
        ans.append('Yes')
    else:
        ans.append('No')
        
if 'Yes' in ans:
    print('Yes')
else:
    print('No')

Solution (Python):
x,y=map(int,input().split())

if x==2 or y==2:
    print('No')
elif x==4:
    if y==6 or y==9 or y==11:
        print('Yes')
    else :
        print('No')
elif x==6:
    if y==9 or y==11:
        print('Yes')
    else :
        print('No')
elif x==9:
    if y==11:
        print('Yes')
    else :
        print('No')
elif x==11:
    print('No')
else :
    print('Yes')

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

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

Solution (Python):
x, y = map(int, input().split())
if (x-4)*(x-6)*(x-9)==0 and (y-11)*(y-6)*(y-9)==0:
  print('Yes')
  exit()
elif (x-1)*(x-3)*(x-5)*(x-7)*(x-8)*(x-10)==0 and (y-12)*(y-3)*(y-5)*(y-7)*(y-8)*(y-10)==0:
  print('Yes')
  exit()
print('No')

Solution (Python):
x, y = map(int, input().split())

g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
g3 = [2]
judge = []
for index, g in enumerate([g1, g2, g3]):
    if x in g:
        judge.append(index)
    if y in g:
        judge.append(index)
if len(set(judge)) == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
x, y = [int(num) for num in input().split()]
group1 = {1, 3, 5, 7, 8, 10, 12}
group2 = {4, 6, 9, 11}
group3 = {2}
L = [group1, group2, group3]
for group in L:
  if set([x, y]) <= group:
    print("Yes")
    break
else:
  print("No")

Solution (Python):
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) or (x in c and y in c) else 'No')

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

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    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:
        print("Yes")
    elif x in b and y in b:
        print("Yes")
    elif x in c and y in c:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

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

Solution (Python):
import datetime
x, y = map(int,input().split())
if (datetime.date(1, x, 1) + datetime.timedelta(days=32)).day \
    == (datetime.date(1, y, 1) + datetime.timedelta(days=32)).day:
    print("Yes")
else:
    print("No")

Solution (Python):
a,b=map(int,input().split())
l1=[1,3,5,7,8,10,12]
l2=[2]
l3=[4,6,9,11]
if (a in l1 and b in l1) or (a in l2 and b in l2) or (a in l3 and b in l3):
  print("Yes")
else:
  print("No")

Solution (Python):
x,y = map(int,input().split())
a_group = [1,3,5,7,8,10,12]
b_group = [4,6,9,11]
c_group = [2]

if x in a_group and y in a_group:
    print('Yes')
elif x in b_group and y in b_group:
    print('Yes')
elif x in c_group and y in c_group:
    print('Yes')
else:
    print('No')

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

Solution (Python):
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, Y} <= A or {X, Y} <= B or {X, Y} <= C else 'No')

Solution (Python):
group31 = {1, 3, 5, 7, 8, 10, 12}
group30 = {4, 6, 9, 11}
group28 = {2}

x, y = map(int, input().split())

if x in group31 and y in group31 or x in group30 and y in group30 or x in group28 and y in group28:
    print("Yes")
else:
    print("No")

Solution (Python):
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 else 'Yes' if x in b and y in b else 'No')

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

Solution (Python):
x, y = map(int,input().split())

def judge_abc(z):
    A = [1, 3, 5, 7, 8, 10, 12]
    B = [4, 6, 9, 11]
    C = [2]
    if z in A: return 1
    elif z in B: return 2
    else: return 3

if judge_abc(x)==judge_abc(y):print('Yes')
else:print('No')

Solution (Python):
x, y = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
if A.count(x) * A.count(y) + B.count(x) * B.count(y) + C.count(x) * C.count(y):
    print("Yes")
else: print("No")

Solution (Python):
x, y = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
if A.count(x) * A.count(y) + B.count(x) * B.count(y):
    print("Yes")
else: print("No")

Solution (Python):
s = input().split()
s = map(int, s)
res = []
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]
for i in s:
    if i in group1:
        res.append('group1')
    elif i in group2:
        res.append('group2')
    else:
        res.append('group3')
if len(list(set(res))) == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

for g in (a, b, c):
  if x in g and y in g:
    print('Yes')
    exit()
print('No')

Solution (Python):
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)&(y in a) or (x in b)&(y in b) or (x in c)&(y in c):
  print("Yes")
else:
  print("No")

Solution (Python):
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

x, y = na()
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
print('Yes' if (x in a and y in a) or (x in b and y in b) else 'No')

Solution (Python):
x,y=map(int,input().split())
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
if A.count(x)*A.count(y)+B.count(x)*B.count(y):
    print("Yes")
else: print("No")

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

Solution (Python):
x,y = (int(i) for i in input().split())

list1 = [1,3,5,7,8,10,12]
list2 = [4,6,9,11]

if x in list1 and y in list1:
    print('Yes')
    
elif x in list2 and y in list2:
    print('Yes')
    
else:
    print('No')

Solution (Python):
x,y=map(int,input().split())
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
if A.count(x)*A.count(y)+B.count(x)*B.count(y):
    print("Yes")
else: print("No")

Solution (Python):
x, y = 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) or (x in G2 and y in G2) or (x in G3 and y in G3):
    print('Yes')
else:
    print('No')

Solution (Python):
a, b = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
flag = False
if a in A and b in A:
  flag = True
if a in B and b in B:
  flag = True
  
if flag :
  print("Yes")
else :
  print("No")

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

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

Solution (Python):
x, y = map(int, input().split())

G = [4, 6, 9, 11]

if x == 2 or y == 2:
    print("No")
elif (x in G and y in G) or (x not in G and y not in G):
    print("Yes")
else:
    print("No")

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

Solution (Python):
x,y=map(int,input().split())

a=[1,3,5,7,8,10,12]
b=[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')

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

Solution (Python):
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")

Solution (Python):
x, y = map(int, input().split())
a = set([1, 3, 5, 7, 8, 10, 12])
b = set([4, 6, 9, 11])
c = set([2])
g = [a, b, c]
is_same_group = False
for gg in g:
    if x in gg and y in gg:
        is_same_group = True
        break
if is_same_group:
    print('Yes')
else:
    print("No")

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

Solution (Python):
def main():
    x, y = 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:
        return "Yes"
    if x in g2 and y in g2:
        return "Yes"
    if x in g3 and y in g3:
        return "Yes"
    return "No"

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

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

Solution (Python):
s = set(map(int, input().split()))
b, c = {4, 6, 9, 11}, {2}
a = {i for i in range(1, 13)}-b-c
print('Yes' if any(x & s == s for x in (a, b, c)) else 'No')

Solution (Python):
abcList = [[4, 6, 9, 11], [2]]
x, y = map(int, input().split())
a = (abcList[0].count(x) == abcList[0].count(y))
b = (abcList[1].count(x) == abcList[1].count(y))
print("Yes" if (a and b) else "No")

Solution (Python):
x,y = map(int, input().strip().split(' '))
def group(n):
  if n in {1,3,5,7,8,10,12}:
    return 0
  elif n in {4,6,9,11}:
    return 1
  elif n in {2}:
    return 2
print('Yes' if group(x) == group(y) else 'No')

Solution (Python):
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

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")
elif (x in g3) and (y in g3):
  print("Yes")
else:
  print("No")

Solution (Python):
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")

Solution (Python):
x,y = map(int, input().split())

if x == 2 or y == 2:
    print("No")
    exit()

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]

if (x in a and y in a) or (x in b and y in b):
    print("Yes")
else:
    print("No")

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

Solution (Python):

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


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


if __name__ == '__main__':
    main()

Solution (Python):
x,y = map(int,input().split())
Group1 = [1,3,5,7,8,10,12]
Group2 = [4,6,9,11]
Group3 = [2]

if x in Group1:
	if y in Group1:
		print("Yes")
	else:
		print("No")
elif x in Group2:
	if y in Group2:
		print("Yes")
	else:
		print("No")
elif x in Group3:
	if y in Group3:
		print("Yes")
	else:
		print("No")
else:
	print("No")

Solution (Python):
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
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")

Solution (Python):
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:
  print('Yes')
elif x in b and y in b:
  print('Yes')
else:
  print('No')

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

Solution (Python):
x,y=map(int,input().split())
list=[1,3,1,2,1,2,1,1,2,1,2,1]
if list[x-1]==list[y-1]:
  print("Yes")
else:
  print("No")

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

Solution (Python):
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')

Solution (Python):
a,b = [int(i) for i in input().split()]

l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = 2

if 2 in (a,b):
  print('No')
elif a in l1 and b in l2:
  print('No')
elif a in l2 and b in l1:
  print('No')
else:
  print('Yes')

Solution (Python):
x, y = map(int, input().split())
g = (0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0)
print("Yes" if g[x] is g[y] else "No")

Solution (Python):
l = [{1,3,5,7,8,10,12},{4,6,9,11},{2}]
x,y = map(int,input().split())
xy = {x,y}
ans = "No"
for i in l:
    if len(xy&i)==2:
        ans = "Yes"
print(ans)

Solution (Python):
x, y = map(int, input().split())
f = (4, 6, 9, 11)
g = (1, 3, 5, 7, 8, 10, 12)
print("Yes" if x == y == 2 or x in g and y in g or x in f and y in f else "No")

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

Solution (Python):
x, y = map(int, input().split())
g1 = [2]
g2 = [4, 6, 9, 11]
g3 = [1, 3, 5, 7, 8, 10, 12]
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")

Solution (Python):
x, y = map(int,input().split())
a = [1,3,5,7,8,10,12]
b = [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')

Solution (Python):
x,y = list(map(int,input().split()))
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
f = False

if x in g1 and y in g1:
  f = True
if x in g2 and y in g2:
  f = True

if f:
  print("Yes")
else:
  print("No")

Solution (Python):
g1 = ["1", "3", "5", "7", "8", "10", "12"]
g2 = ["4", "6", "9", "11"]
x, y = input().split()
if x in g1 and y in g1 or x in g2 and y in g2:
    print("Yes")
else:
    print("No")

Solution (Python):
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

x, y = map(int,input().split())

if x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
elif x in c and y in c:
    print('Yes')
else:
    print('No')

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

Solution (Python):
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")

Solution (Python):
lis = [1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
x, y = map(lambda z: int(z) - 1, input().split())
print("Yes") if lis[x] == lis[y] else print("No")

Solution (Python):
x,y = map(int,input().split())
grouplist = [0,1,3,1,2,1,2,1,1,2,1,2,1]
if grouplist[x]==grouplist[y]:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
g3 = [2]

a,b = map(int, input().split())

if a in g1 and b in g1:
  print('Yes')
elif a in g2 and b in g2:
  print('Yes')
elif a in g3 and b in g3:
  print('Yes')
else:
  print('No')

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

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")

Solution (Python):
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [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")

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