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: introductory

Starter code:

Solutions:
n1 = [1, 3, 5, 7, 8, 10, 12]
n2 = [4, 6, 9, 11]

a, b = list(map(int, input().split()))
print(("Yes" if a in n1 and b in n1 or a in n2 and b in n2 else "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')

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

a,b,c=[1,3,5,7,8,10,12],[4,6,9,11],[2]
print('YNeos'[len(set([0 if i in a else [1,2][i in b] for i in list(map(int,input().split()))]))!=1::2])

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)

x,y=map(int,input().split())
grp1=[1,3,5,7,8,10,12]
grp2=[4,6,9,11]

if x in grp1 and y in grp1: print("Yes")
elif x in grp2 and y in grp2: print("Yes")
else: print("No")

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

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

#!/usr/bin/env python3
x, y = list(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')


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

x = [1,3,5,7,8,10,12]
y = [4,6,9,11]

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

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

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

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

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

n=[0,1,3,1,2,1,2,1,1,2,1,2,1]

if n[x]==n[y]:
    ans="Yes"
else:
    ans="No"
            
print(ans)

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')
else:
    print('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")

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

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

if x in a and x not in b and x not in c and y in a and y not in b and y not in c:
  print('Yes')
elif x not in a and x in b and x not in c and y not in a and y in b and y not in c :
  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")

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


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=[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 = list(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')

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

l = ((1,3,5,7,8,10,12),(4,6,9,11),(0,2))
x,y = map(int, input().split())
p = 0
for i in l:
	if x in i and y in i:
		p = 1
		break
ans = 'Yes' if p == 1 else 'No'
print(ans)

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

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

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

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

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


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

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


def solve():
    x, y = list(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")


def __starting_point():
    solve()

__starting_point()

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

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

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

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
x, y = map(int, input().split())
if a.count(x) * a.count(y) > 0 or b.count(x) * b.count(y) > 0 or c.count(x) * c.count(y) > 0:
    print("Yes")
else:
    print("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)

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")
  
else:
  if b == 2 or b == 4 or b == 6 or b == 9 or b == 11:
    print("No")
  else:
    print("Yes")

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

s=list(map(int,input().split()))

for i in a:
  if s[0]==i:
    p=0
  elif s[0]==2:
    p=2
  else:
    p=1

for i in a:
  if s[1]==i:
    q=0
  elif s[1]==2:
    q=2
  else:
    q=1

if p==q:
  print('Yes')
else:
  print('No')


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

a, b = 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")

x, y = list(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')


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())
 
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
 
if 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')

x,y=map(int, input().split())  
g=[[1,3,5,7,8,10,12],[4,6,9,11]]
print("Yes" if any(x in g[i] and y in g[i] for i in range(2)) else "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())

grp1=[1,3,5,7,8,10,12]
grp2=[4,6,9,11]

if x in grp1 and y in grp1: print('Yes')
elif x in grp2 and y in grp2: print('Yes')
else: print('No')

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

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

L=[1,0,1,2,1,2,1,1,2,1,2,1]
a,b=map(int,input().split())
if L[a-1]==L[b-1]:
  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())
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')

x,y=list(map(int,input().split()))
A={1,3,5,7,8,10,13}
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 = [-1, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
x, y = map(int, input().split())
if g[x] == g[y]: 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")


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

g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]


if x == 2 and y == 2:
    print("Yes")
elif x in g1 and y in g1:
    print("Yes")
elif x in g2 and y in g2:
    print("Yes")
else:
 print("No")

a,b=map(int,input().split())
s=[1,3,5,7,8,10,12]
t=[4,6,9,11]
if a in s:
    a = 0
elif a in t:
    a = 1
else:
    a = 2
if b in s:
    b = 0
elif b in t:
    b = 1
else:
    b = 2
print("Yes" if a==b 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)])

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    x, y = LI()
    d = {1: 0, 2: 2, 3: 0, 4: 1, 5: 0, 6: 1, 7: 0, 8: 0, 9: 1, 10: 0, 11: 1, 12: 0}

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

def __starting_point():
    resolve()

__starting_point()

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

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 = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int,input().split())

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

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

x,y=list(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")


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

a,b = map(int,input().split())
x = [1,3,5,7,8,10,12]
y = [4,6,9,11]
if a == 2 or b == 2:
    print("No")
else:
    if a in x and b in x:
        print("Yes")
    elif a in y and b in y:
        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:
  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")

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
#MOD = 998244353


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

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

if x == 2 or y == 2:
  print('No')
elif 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())
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")

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

group_1 = {1, 3, 5, 7, 8, 10, 12}
group_2 = {4, 6, 9, 11}

if (x in group_1) and (y in group_1):
    print('Yes')
elif (x in group_2) and (y in group_2):
    print('Yes')
else:
    print('No')


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

x, y = map(int, input().split())
d = {1:1, 3:1, 5:1, 7:1, 8:1, 10:1, 12:1, 4:2, 6:2, 9:2, 11:2, 2:3}
if d[x]==d[y]:
    print("Yes")
else:
    print("No")

s = "0131212112121"
x,y = map(int,input().split())
print("Yes" if s[x]==s[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")

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

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

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

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


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


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


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

r = list(map(int,input().split()))
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if r[0]==2 or r[0]==2:
  print('No')
elif len(list(set(r) & set(a))) == 2:
  print('Yes')
elif len(list(set(r) & set(b))) == 2:
  print('Yes')
else:
  print('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())

g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]

print("Yes" if (x in g1 and y in g1) or (x in g2 and y in g2) else "No")

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

x, y = input().split()

for i in range(0, 7):
    if int(x) == a[i] or int(y) == a[i]:
        acount += 1

for i in range(0, 4):
    if int(x) == b[i] or int(y) == b[i]:
        bcount += 1

if int(x) == c[0]:
    ccount += 1
if int(y) == c[0]:
    ccount += 1


if acount == 2 or bcount == 2 or ccount == 2:
    print("Yes")
else:
    print("No")




g = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
x, y = map(int, input().split())
for i in range(len(g)):
    if x in g[i]:
        xg = i
    if y in g[i]:
        yg = i
if xg == yg:
    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')

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

x,y=map(int,input().split())
g1 = {1,3,5,7,8,10,12}
g2 = {4,6,9,11}
g3 = {2}

def group(z):
  if z in g1:return 1
  elif z in g2:return 2
  else: return 3
  
if group(x)==group(y):print('Yes')
else:print('No')

'''
abc062 A - Grouping
https://atcoder.jp/contests/abc062/tasks/abc062_a
'''

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

#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]

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