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=map(int,raw_input().split())
G="_020101001010"
print["No","Yes"][G[x]==G[y]]

Solution (Python):
s,t=input().split()
x=int(s)
y=int(t)
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
C=[2]
for i in range(7):
  if A[i]==x:
    s="A"
  if A[i]==y:
    t="A"
for i in range(4):
  if B[i]==x:
    s="B"
  if B[i]==y:
    t="B"
if x==2:
  s="C"
if y==2:
  t="C"
if s==t:
  print("Yes")
else:
  print("No")

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

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

if (xy[0]in B and xy[1] in B) or (xy[0]in C and xy[1] in C):
    print('Yes')
else:
    print('No')

Solution (Python):
groups = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = map(int, input().split())
for i in range(3):
    if x in groups[i]: x = i
    if y in groups[i]: y = i

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

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

Solution (Python):
import fileinput


GROUPS = list(enumerate([{1,3,5,7,8,10,12}, {4,6,9,11}, {2}]))


def group(n):
    for i, g in GROUPS:
        if n in g:
            return i
    return -1


def algorithm(input_lines):
    x, y = [int(n) for n in input_lines[0]]
    return "Yes" if group(x) == group(y) else "No"


def run():
    out = algorithm([l.strip().split(" ") for l in fileinput.input()])
    print(out)


run()

Solution (Python):

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

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

ans = str()

if a in x and b in x:
    ans = 'Yes'
elif a in y and b in y:
    ans = 'Yes'
elif a == z and b == z:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)



if __name__ == '__main__':
    pass

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=(1,3,5,7,8,10,12)
b=(4,6,9,12)
c=(2)
if x in a and y in a:
  print('Yes')
elif x in b and y in b:
  print('Yes')
elif x == c and y == c:
  print('Yes')
else:
  print('No')

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

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

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

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

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

flag = False

if x in a and y in a:
    flag = True
if x in b and y in b:
    flag = True
if x in c and y in c:
    flag = True

if flag:
    print 'Yes'
else:
    print 'No'

Solution (Python):
print('YNeos'['2'in input()::2])

Solution (Python):
a,b=map(int,input().split())
if(a==4 or a==6 or a==9 or a==11):
  aa=2
elif(a==2):
  aa=3
else:
  aa=1
  
if(b==4 or b==6 or b==9 or b==11):
  bb=2
elif(b==2):
  bb=3
else:
  bb=1

if(aa==bb):
  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())
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:
    ans = "Yes"
else:
    ans = "No"
print(ans)

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

if x==2 or y==2:
    print("No")
    quit()
else:
    if x in L1 and y in L1:
        print("Yes")
    elif x in L2 and y in L2:
        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 else "Yes" if x in b and y in b else "Yes" if x in c and y in c else "No")

Solution (Python):
a,b = map(int,input().split())
c = 0 
d = 0
if a == 2:
    c = 1
elif a == 4 or a == 6 or a == 9 or a == 11:
    c = 2
else:
    c = 3
if b == 2:
    d = 1
elif b == 4 or b == 6 or b == 9 or b == 11:
    d = 2
else:
    d = 3
if c == d:
    print("Yes")
else:
    print("No")

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

Solution (Python):
group1=[1,3,5,7,8,10,12]
group2=[4,6,9,11]
group3=[2]
a,b=map(int,input().split())
if(a==2 and b==2):
  print('Yes')
elif(((a in group1) and (b in group1)) or ((a in group2) and (b 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):
""" AtCoder """

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=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
d=[a,b,c]
for i in d:
    if x in i and y in i:
        print('Yes')
        exit()
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) or (x in group_b and y in group_b) or (x in group_c and y in group_c):
    print('Yes')
else:
    print('No')

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

print('Yes' if any(x in g and y in g for g in G) else 'No')

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

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

print('Yes' if any(x in g and y in g for g in G) 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())

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

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 = (int(i) for i in input().split())
groupA = [1,3,5,7,8,10,12]
groupB = [4,6,9,11]
groupC = [2]
if x in groupA and y in groupA:
  print('Yes')
elif x in groupB and y in groupB :
  print('Yes')
else:
  print('No')

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

def getIntList(): return [int(x) for x in input().split()]

A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
C = {2}
x,y = getIntList()
res = 'No'
if (x in A and y in A) or (x in B and y in B) or (x in C and y in C): res = 'Yes'
print(res)

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

Solution (Python):
x, y = [int(x) for x in input().split()]
g = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

print('Yes' if any([(x in i) and (y in i) for i in g]) 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())
for g in [a, b, c]:
    if x in g and y in g:
        print('Yes')
        break
else:
    print('No')

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

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

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

Solution (Python):
X = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x,y = map(int,input().split())
if X[x] == X[y]:
    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==y:
    print("Yes")
else:
    if A.count(x)==1 and A.count(y)==1:
        print("Yes")
    elif B.count(x)==1 and B.count(y)==1:
        print("Yes")
    else:
        print("No")

Solution (Python):
X,Y = map(int,input().split())

Ans = "No"
A = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
for i in range(3):
    if X in A[i] and Y in A[i]:
        Ans = "Yes"

print(Ans)

Solution (Python):
gp1 = [1,3,5,7,8,10,12]
gp2 = [4,6,9,11]
gp3 = [2]
x,y = [int(i) for i in input().split()]

if ((x in gp1 and y in gp1) or (x in gp2 and y in gp2) or(x in gp3 and y in gp3)) :
    print("Yes")
else :
    print("No")

Solution (Python):
X, Y = [int(_) for _ in input().split()]


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

if gs[X] == gs[Y]:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
from sys import stderr, setrecursionlimit
from functools import reduce
from operator import add
setrecursionlimit(2147483647)
def getInt():
    return int(input())
def getInts():
    return [int(i) for i in input().split()]
def getIntLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInt())
    return res
def getIntsLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInts())
    return res
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

x, y = getInts()
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) or (x == y == 2) else "No")

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

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

Solution (Python):
int_x, int_y = map(int, input().split())

g_a = [1, 3, 5, 7, 8, 10, 12]
g_b = [4, 6, 9, 11]

if int_x in g_a and int_y in g_a:
    print("Yes")
elif int_x in g_b and int_y in g_b:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
x, y = map(int, input().split())
setA = []
setA.append({1, 3, 5, 7, 8, 10, 12})
setA.append({4, 6, 9, 11})
setA.append({2})
 
for s in setA:
  if x in s and y in s:
    print("Yes")
    exit()
print("No")

Solution (Python):
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
def grp(x,y):
    if x in y:
        return 1
    else:
      	return 0
x,y = map(int,input().split())
if grp(x,A)*grp(y,A) or grp(x,B)*grp(y,B) or grp(x,C)*grp(y,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 = 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 ,b  = map(int, input().split())
g2 =  [4,6,9,11]
g1 =[1,3,5,7,8,10,12]
if a in g2 and b in g2:
    print("Yes")
elif a == 2 and b ==2:
    print("Yes")
elif a in g1 and b in g1:
    print("Yes")
else:print("No")

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

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

if((a in A and b in A) or (a in B and b in B) or (a in C and b in C)):
    print("Yes")
else:
    print("No")

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


abc062_a()

Solution (Python):
x, y = [int(i) for i in 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):
a, b = (int(x) for x in input().split())
list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]

if ((a in list1) & (b in list1)):
  print("Yes")
elif ((a in list2) & (b in list2)):
  print("Yes")
else:
  print("No")

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

Solution (Python):
x, y = (int(x) for x 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)) 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=input().strip().split()
Z=['1','3','5','7','8','10','12']
I=['4','6','9','11']
if x in Z and y in Z:
    print('Yes')
elif x in I and y in I:
    print('Yes')
elif x==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(((x in A)and(y in A)) or ((x in B)and(y in B)) or (x == 2 and y == 2)):
  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) == 1 and a.count(y) == 1:
    print("Yes")
elif b.count(x) == 1 and b.count(y) == 1:
    print("Yes")
elif x == 2 and y == 2:
    print("Yes")

else:
    print("No")

Solution (Python):
def group(x):
    if x == 2:
        return 2
    if x in [4, 6, 9, 11]:
        return 1
    return 0


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


if __name__ == '__main__':
    main()

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())
l = [1,3,5,7,8,10,12]
m = [4,6,9,11]
if x==y:
    print('Yes')
    exit()
if x==2 or y==2:
    print('No')
    exit()
if x in l and y in l:
    print('Yes')
elif x in m and y in m:
    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:
    if y in A:
        print("Yes")
    else:
        print("No")
elif x in B:
    if y in B:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

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

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

Solution (Python):
from statistics import mean, median,variance,stdev
import sys
import math

x = input().split()

a= []
for i in range(len(x)):
    a.append(int(x[i]))

z = [1,3,5,7,8,10,12]
y = [4,6,9,11]
if a[0] in [2] or a[1] in [2]:print("No")
elif a[0] in z and a[1] in  z: print("Yes")
elif a[0] in y and a[1] in 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}
S = {x,y}
if (S <= A or S <= B) is True:
  print("Yes")
else:
  print("No")

Solution (Python):



def main():
    """Function."""
    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")


if __name__ == "__main__":
    main()

Solution (Python):
x,y=[int(i) for i in input().split()]
a=[[1,3,5,7,8,10,12],[4,6,9,11]]
ans="No"
for i in [0,1]:
  if a[i].count(x) and a[i].count(y):
    ans="Yes"
print(ans)

Solution (Python):
x, y = [int(i) for i in 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):
l = [3, 0, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 0]
x, y = map(int, input().split())
if l[x] == l[y]:
  print("Yes")
else:
  print("No")

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

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

elif(x in c and y in c):
    print("Yes")

else:
    print('No')

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

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

Solution (Python):
x, y = [int(_) for _ in input().split()]
ABC = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
for i in range(3):
    if x in ABC[i] and y in ABC[i]:
        print('Yes')
        exit()
print('No')

Solution (Python):
import sys
a=list(map(int,input().split()))
flg=0
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
C=[2]
for i in range(len(A)):
    if A[i]==a[0]:
        for j in range(len(A)):
            if A[j]==a[1]:
                flg=1
for i in range(len(B)):
    if B[i]==a[0]:
        for j in range(len(B)):
            if B[j]==a[1]:
                flg=1
if flg==1:
    print("Yes")
else:
    print("No")

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

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

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

gA = [1, 3, 5, 7, 8, 10, 12]
gB = [4, 6, 9, 11]
gC = [2]

flg = False
for g in [gA, gB, gC]:
    if x in g:
        if y in g:
            print("Yes")
            flg = True

if not flg:
    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:
    flagx = 0
if x in b:
    flagx = 1
if x in c:
    flagx = 2
if y in a:
    flagy = 0
if y in b:
    flagy = 1
if y in c:
    flagy = 2
if flagx == flagy:
    print("Yes")
else:
    print("No")

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

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:
    ans = 1
elif x==4 or x==6 or x==9 or x==11:
    ans = 2
else:
    ans = 3
if y==1 or y==3 or y==5 or y==7 or y==8 or y==10 or y==12:
    sna = 1
elif y==4 or y==6 or y==9 or y==11:
    sna = 2
else:
    sna = 3
if ans == sna:
    print("Yes")
else:
    print("No")

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

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

result = 'No'
for ti in t:
    if x in ti and y in ti:
        result = 'Yes'
        break;

print(result)

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

d=input().strip().split(" ")
e=[int(i) for i in d]

if (e[0] in a and e[1] in a):
    print("Yes")

elif e[0] in b and e[1] in b:
    print("Yes")

elif e[0] in c and e[1] in c:
    print("Yes")

else:
    print("No")

Solution (Python):

par=[]
rank=[]
def init(a): 
    for i in range(a):
        par.append(i)
        rank.append(0)
def find(x): 
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
    return par[x]
def unite(x,y): 
    x=find(x)
    y=find(y)
    if rank[x]==rank[y]:
        par[x]=y
    else:
        par[y]=x
        if rank[x]==rank[y]:
            rank[x]+=1
    return
def same(x,y): 
    return find(x)==find(y)

init(12)
unite(0,2)
unite(0,4)
unite(0,6)
unite(0,7)
unite(0,9)
unite(0,11)
unite(3,5)
unite(3,8)
unite(3,10)

x,y=map(int,input().split())
print('Yes' if same(x-1,y-1) else 'No')

Solution (Python):
x,y=map(int,input().split())
l=[[4,6,9,11],[2],[1,3,5,7,8,10,12]]
for i in l:
  if x in i:xx=l.index(i)
  if y in i:yy=l.index(i)
print('YNeos'[xx!=yy::2])

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

P = [1, 3, 5, 7, 8, 10, 12]
Q = [4, 6, 9, 11]
R = [2]

if x in P:
    if y in P:
        print('Yes')
    else:
        print('No')
if x in Q:
    if y in Q:
        print('Yes')
    else:
        print('No')
if x in R:
    if y in R:
        print('Yes')
    else:
        print('No')

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

ans = 'No'
if x in a and y in a:
	ans = 'Yes'
elif x in b and y in b:
	ans = 'Yes'
elif x in c and y in c:
	ans = 'Yes'

print(ans)

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

Solution (Python):
class UnionFind():
	def __init__(self, n):
		self.par = [i for i in range(n + 1)]
		self.rank= [1] * (n + 1)

	def root(self, x):
		return x if self.par[x] == x else self.root(self.par[x])
	
	def same(self, x, y):
		return self.root(x) == self.root(y)

	def unite(self, x, y):
		rx = self.root(x)
		ry = self.root(y)
		if rx == ry:
			return
		if self.rank[rx] < self.rank[ry]:
			self.par[rx] = ry
		else:
			self.par[ry] = rx
			if self.rank[rx] == self.rank[ry]:
				self.rank[rx] += 1
		
			
			
x, y = map(int, raw_input().split())
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]
uf = UnionFind(12)
for i in g1:
	uf.unite(g1[0], i)
for i in g2:
	uf.unite(g2[0], i)
for i in g3:
	uf.unite(g3[0], i)

print "Yes" if uf.same(x, y) else "No"

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

Solution (Python):
A = set([1,3,5,7,8,10,12])
B = set([4,6,9,11])
L = set([int(i) for i in input().split()])
if len(A&L) == 2 or len(B&L) == 2:
  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):
array = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
x, y = map(int, input().split())
for i in range(len(array)):
    if x in array[i]:
        if y in array[i]:
            print('Yes')
            break
        else:
            print('No')
            break

Solution (Python):
import calendar

a,b = map(int,input().split())
_, lastday =calendar.monthrange(2018, a)
_, lastdayb = calendar.monthrange(2018,b)
print("Yes" if lastday == lastdayb else "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)or(y==2):
    print('No')
elif x in a:
    if y in a:
        print('Yes')
    else:
        print('No')
else:
    if y in b:
        print('Yes')
    else:
        print('No')

Solution (Python):
groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
gg = lambda t: [i for i in range(0, 3) if t in groups[i]][0]
x, y = map(int, input().split())
print('Yes' if gg(x) == gg(y) else 'No')

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

Solution (Python):
import numpy as np
lis = np.array([[1,3,5,7,8,10,12],[4,6,9,11],[2]]);a,b = map(int,input().split())
for i in lis:
    if a in i and b in i:print("Yes");exit()
print("No")

Solution (Python):
A = [4,6,9,11]
x,y = map(int,input().split())
if x in A:
  x = 4
elif x != 2:
  x = 3
if y in A:
  y = 4
elif y != 2:
  y = 3
if x == y:
  print('Yes')
else:
  print('No')

Solution (Python):
num = list(map(int, input().split()))
if num[0]==2  or num[1] ==2:
	print('No')
elif num[0] == 4:
	if num[1] == 6 or num[1] == 9 or num[1] == 11:
		print('Yes')
	else:
		print('No')
elif num[0] == 6:
	if num[1] == 9 or num[1] == 11:
		print('Yes')
	else:
		print('No')
elif num[0] == 9:
	if num[1] == 11:
		print('Yes')
	else:
		print('No')
elif num[0] == 11:
	print('No')
else:
	print('Yes')

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

def check(n):
    if n == 2:
        return 1
    elif n == 4 or n == 6 or n == 9 or n == 11:
        return 2
    else:
        return 3

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

Solution (Python):
import sys
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:
    if y in a:
        print('Yes')
        sys.exit()
if x in b:
    if y in b:
        print('Yes')
        sys.exit()
if x in c:
    if y in c:
        print('Yes')
        sys.exit()
print('No')

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

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

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

elif x == 2 and y == 2:
    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())
g1 = set([1, 3, 5, 7, 8, 10, 12])
g2 = set([4, 6, 9, 11])
g3 = set([2])

ans = "No"
for g in [g1, g2, g3]:
    if x in g and y in g:
        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('NYoe s'[a.count(x)==a.count(y)!=0 or b.count(x)==b.count(y)!=0 or c.count(x)==c.count(y)!=0::2])

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

x, y = input().split()
if x in group1 and y in group1:
    print('Yes')
elif x in group2 and y in group2:
    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]

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

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

risuto1 = [1,3,5,7,8,10,12]
risuto2 = [4,6,9,11]
risuto3 = [2]

if x in risuto1 and y in risuto1:
    print("Yes")
elif x in risuto2 and y in risuto2:
    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]

def grouping(x,y):
  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')


grouping(x,y)

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) == 1 or b.count(x)*b.count(y) == 1 \
or c.count(x)*c.count(y):
  print("Yes")
else:
  print("No")

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

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

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

if x == 2 or y == 2:
    print("No")
else:
    if x in listB and y in listB:
        print("Yes")
    elif x in listA and y in listA:
        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]
print(["No", "Yes"][group[x] == group[y]])

Solution (Python):

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

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