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



Sample input:
1 3


Sample output:
Yes

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

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

if x in l1 and y in l1:
    print('Yes')
elif x in l2 and y in l2:
    print('Yes')
elif x in l3 and y in l3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')
elif x == 2 and y == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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')

Submission status: Accepted

Solution code:
def solve():
    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__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

a, b = map(int, input().split())
print("Yes" if a in n1 and b in n1 or a in n2 and b in n2 else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    xy = set(list(map(int, readline().split())))
    A = set([1,3,5,7,8,10,12])
    B = set([4,6,9,11])
    C = set([2])
    if xy<=A or xy<=B or xy<=C:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#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 = 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")

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = 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')

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
ls = [A,B,C]
ans = 'No'
for i in range(3):
    if x in ls[i] and y in ls[i]:
        ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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) or (x in a and y not in a) or (x in b and y not in b):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
d=[1,3,5,7,8,10,12]
if x==2 or y==2:
  print("No")
elif x in d and y in d:
  print("Yes")
elif x not in d and y not in d:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

list_1 = [1, 3, 5, 7, 8, 10, 12]
list_2 = [4, 6, 9, 11]
list_3 = [2]

if x in list_1:
  tmp = list_1
elif x in list_2:
  tmp = list_2
else:
  tmp = list_3

if y in tmp:
  ans = 'Yes'
else:
  ans = 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = list(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:
  print('Yes')
elif a in y and b in y:
  print('Yes')
elif a == 2 and b == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
G = 'XACABABAABABA'

print("Yes" if(G[x] == G[y]) else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if x==y==2:
    print("Yes")
elif x==4:
    if y==6 or y==9 or y==11:
        print("Yes")
    else:
        print("No")
elif x==6:
    if y==4 or y==9 or y==11:
        print("Yes")
    else:
        print("No")
elif x==9:
    if y==6 or y==4 or y==11:
        print("Yes")
    else:
        print("No")
elif x==11:
    if y==6 or y==9 or y==4:
        print("Yes")
    else:
        print("No")


else:
    if y!=2 and y!=4 and y!=6 and y!=9 and y!=11:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
"""AtCoder."""


def get_group(n):
    if n in [1,3,5,7,8,10,12]:
        return 0
    
    if n in [4, 6, 9, 11]:
        return 1

    if n in [2]:
        return 2

def main():
    x, y = map(int, input().split())
    
    if get_group(x) == get_group(y):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
g = [31,28,31,30,31,30,31,31,30,31,30,31]
 
tmp = input().split(" ")
print("Yes") if g[int(tmp[0]) - 1] == g[int(tmp[1]) - 1] else print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
x, y = M()
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==y:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x, y = [int(s) for s in input().split()]
temp_list = [-1, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
print("Yes" if temp_list[x] == temp_list[y] else "No")

Submission status: Accepted

Solution code:
x, y = [int(s) for s in input().split()]
temp_list = [{1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 1}, {2}]
ans = "No"
for temp in temp_list:
    if x in temp and y in temp:
        ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = [set()] * 3
    S[0] = {1, 3, 5, 7, 8, 10, 12}
    S[1] = {4, 6, 9, 11}
    S[2] = {2}

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

    ans = 'No'
    for s in S:
        if x in s and y in s:
            ans = 'Yes'
            break

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
sa=(1,3,5,7,8,10,12,)
sb=(4,6,9,11,)
sc=(2,)
l=[sa,sb,sc]

a,b=map(int,input().split())
for ss in l:
  if a in ss and b in ss:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
s0=1<<(x-1)|1<<(y-1)
s1=sum(list(map(lambda x:1<<(x-1),[1,3,5,7,8,10,12])))&s0
s2=sum(list(map(lambda x:1<<(x-1),[4,6,9,11])))&s0
s3=sum(list(map(lambda x:1<<(x-1),[2])))&s0

if s1==s0 or s2==s0 or s3==s0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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}
a=list(map(int,input().split()))
if d[a[0]]==d[a[1]]: 
    print('Yes')
else: 
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

L = [list1,list2]

ans = "No"

for i in L:
  if x in i and y in i:
    ans = "Yes"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l1 = [1, 3, 5, 7, 8, 10, 12]
l2 = [4, 6, 9, 11]

x, y = map(int, input().split())
flg = x in l1 and y in l1 or x in l2 and y in l2
print("Yes" if flg else "No")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
mydict = {1:"a", 2:"c", 3:"a", 4:"b", 
          5:"a", 6:"b", 7:"a", 8:"a", 9:"b", 10:"a", 11:"b", 12:"a"}
if mydict[a] == mydict[b]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

if a in A and b in A:
    print('Yes')
elif a in B and b in B:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
gp1=[1,3,5,7,8,10,12]
gp2=[4,6,9,11]

x,y=map(int,input().split())
if x in gp1 and y in gp1:
    print('Yes')
elif x in gp2 and y in gp2 :
    print('Yes')
elif x==y==2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
xy = list(map(int, input().split())) 
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
g3 = [2]
if set(xy) <= set(g1) or set(xy) <= set(g2) or set(xy) <= set(g3):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
def LI():
    return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

x,y = LI()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

grp_dict = {
    1: 'A',
    2: 'C',
    3: 'A',
    4: 'B',
    5: 'A',
    6: 'B',
    7: 'A',
    8: 'A',
    9: 'B',
    10: 'A',
    11: 'B',
    12: 'A',
}

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

Submission status: Accepted

Solution code:
x,y = [int(i) for i in 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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
b = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

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

Submission status: Accepted

Solution code:
x,y = (int(x) for x in input().split())
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
n = 0
if x in l1:
  if y in l1:
    print ('Yes')
    n = 1
elif x in l2:
  if y in l2:
    print ('Yes')
    n = 1
else:
  if y in l3:
    print ('Yes')
    n = 1
if n == 0:
  print ('No')

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
count=0
if x in a:
    if y in a:
        count+=1
    else:
        count+=0
if x not in a and x!=2:
    if y not in a and y!=2:
        count+=1
    else:
        count+=0
if x==2:
    if y==2:
        count+=1
    else:
        count+=0
if count!=0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a, b = [1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11]
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 == y:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
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:
    print("Yes")
    exit()
if x in b and y in b:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
list1 = [1,3,5,7,8,10,12]
list2 = [4,6,9,11]
list3 = [2]

if list1.count(a) == 1:
    if list1.count(b) == 1:
        print("Yes")
    else:
        print("No")
if list2.count(a) == 1:
    if list2.count(b) == 1:
        print("Yes")
    else:
        print("No")
if list3.count(a) == 1:
    if list3.count(b) == 1:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

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