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):
def group(inp):
    if inp ==  '4' or inp == '6' or inp == '9' or inp == '11':
        return 2
    if inp == '2':
        return 3
    else:
        return 1

if __name__ == '__main__':
    x, y = input().split()
    if group(x) == group(y):
        print('Yes')
    else:
        print('No')

Solution (Python):


A = set([1,3,5,7,8,10,12])
B = set([4,6,9,11])
C = set([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):
grp = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

i = list(map(int, input().split()))
flg = False
for g in grp:
    if (i[0] in g) and (i[1] in g):
        flg = True
        break
    else:
        continue

print('Yes') if flg 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('Yes' if group[x] == group[y] else 'No')

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    a = set([1,3,5,7,8,10,12])
    b = set([4,6,9,11])
    c = set([2])
    x,y = LI()
    d = [a,b,c]
    xi = yi = -1
    for i in range(3):
        if x in d[i]:
            xi = i
        if y in d[i]:
            yi = i

    if xi == yi:
        return 'Yes'

    return 'No'



print(main())

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

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

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

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

Solution (Python):


def check_group(n):
    if n == 2:
        return 3
    elif n in (4, 6, 9, 11):
        return 2
    else:
        return 1

x,y = map(int, raw_input().split())
xgroup, ygroup = (check_group(x), check_group(y))
if xgroup == ygroup:
    print "Yes"
else:
    print "No"

Solution (Python):
i1 = input()
i2 = i1.split()

i2[0] = int(i2[0])
i2[1] = int(i2[1])

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

if (i2[0] in l1 and i2[1] in l1) or (i2[0] in l2 and i2[1] in l2) or (i2[0] in l3 and i2[1] in l3):
    print("Yes")
else:
    print("No")

Solution (Python):
def solve():
    a,b=map(int,input().split())
    if a==2 or b==2:
        print("No")
    elif (a==4 and not(b==6 or b==9 or b==11)) or (a==6 and not(b==9 or b==11)) or (a==9 and not b==11) or a==11:
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    solve()

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

    if 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:
  a=1
elif x in B:
  a=2
else:
  a=3
if y in A:
  b=1
elif y in B:
  b=2
else:
  b=3
if a==b:
  print("Yes")
else:
  print("No")

Solution (Python):
ipt = input().split()

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
i=int(ipt[0])
j=int(ipt[1])
if i==j:
    print('Yes')
elif i in a and j in a:
    print('Yes')
elif i in b and j in b:
    print('Yes')
else:
    print('No')

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

x, y = [int(n) for n in input().split()]

if x in lst1 and y in lst1:
    print("Yes")

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

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

groups = [group_1, group_2, group_3]

for group in groups:
    if x in group and y in group:
        print("Yes")
        break
    else:
        None
    if group == group_3:
        print("No")

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

x, y = [int(n) for n in 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):
group = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]

x, y = map(int, input().split())
for i in range(0,2):
    if(group[i].count(x) > 0 and group[i].count(y) > 0):
        print("Yes")
        exit()
print("No")

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

Solution (Python):
from __future__ import division
import math


def get_min(w, h):
    m = 1e11
    for x in [w // 3, w // 3 + 1]:
        if x == 0: continue
        a = [x*h, (w-x)*(h//2), (w-x)*(h - h//2)]
        print a
        m = min(m, max(a) - min(a))
    return m

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

Solution (Python):

x, y = map(int, input().split(" "))
group_a = [1, 3, 5, 7, 8, 10, 12]
group_b = [4, 6, 9, 11]
group_c = [2]
x_group = ""
y_group = ""

if x in group_a:
    x_group = "a"
elif x in group_b:
    x_group = "b"
else:
    x_group = "c"

if y in group_a:
    y_group = "a"
elif y in group_b:
    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 = [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):
""" abc062_a:A - Grouping """
L = input().rstrip().split(' ')

if L[0] == "2" or L[1] == "2":
    print("No")
else:
    for i in range(2):
        num = int(L[i])
        if num > 7:
            num = num - 7
        L[i] = num % 2

    if L[0] == L[1]:
        print("Yes")
    else:
        print("No")

Solution (Python):
def solve():
    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]:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)

if __name__ == '__main__':
    solve()

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

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

input = list(input().split())
input_x = int(input[0])
input_y = int(input[1])

exist_group1 = group1.count(input_x) + group1.count(input_y)
exist_group2 = group2.count(input_x) + group2.count(input_y)
exist_group3 = group3.count(input_x) + group3.count(input_y)

if exist_group1 == 2 or exist_group2 == 2 or exist_group3 == 2:
    print("Yes")
else:
    print("No")

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

input = list(map(int, input().split()))
input_x = int(input[0])
input_y = int(input[1])

exist_group1 = group1.count(input_x) + group1.count(input_y)
exist_group2 = group2.count(input_x) + group2.count(input_y)
exist_group3 = group3.count(input_x) + group3.count(input_y)

if exist_group1 == 2 or exist_group2 == 2 or exist_group3 == 2:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
lis = [0,1,3,1,2,1,2,1,1,2,1,2,1]

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

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

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

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

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

if __name__ == '__main__':
	grouping()

Solution (Python):
import sys

x, y = [int(x) for x in sys.stdin.readline().split()]

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

def inn(x):
	xin = ''
	if x in a:
		xin = 'a'
	elif x in b:
		xin = 'b'
	else:
		xin = 'c'
	return xin

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

Solution (Python):
def flg_fun(a):
    if a in [1,3,5,7,8,10,12]:
        b=1
    else:
        if a==2:
            b=2
        else:
            b=3
    return b


def assign_fun(x, y):
    if x==y:
        print("Yes")
    else:
        if flg_fun(x)==flg_fun(y):
            print("Yes")
        else:
            print("No")

a = input().split(" ")
assign_fun(int(a[0]), int(a[1]))

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

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

print('Yes') if (x == y) or (x in grp1 and y in grp1) or (x in grp2 and y in grp2) else print('No')

Solution (Python):

def f(x, y):
    a = [[1,3,5,7,8,10,12], [4,6,9,11], [2]]
    for b in a:
        if x in b and y in b:
            return True
    return False

x, y = [int(x) for x in input().split(' ')]

print('Yes' if f(x, y) else 'No')

Solution (Python):



group = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]

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

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

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

if a[0] in b:
    a0 = 1
elif a[0] in c:
    a0 = 2
else:
    a0 = 3

if a[1] in b:
    a1 = 1
elif a[1] in c:
    a1 = 2
else:
    a1 = 3

if a0 == a1:
    print("Yes")
else:
    print("No")

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

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

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

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

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

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

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

def f(a):
    if a in [1,3,5,7,8,10,12]:
        return 1
    if a in [4,6,9,11]:
        return 2
    if a == 2:
        return 3
    return None

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

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

for i in lis:
    if x in i:
        if y in i:
            print("Yes")
        else:
            print("No")

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

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

Solution (Python):
import sys


s = [-1, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]

def solve():
    x, y = map(int, input().split())

    if s[x] == s[y]:
        ans = 'Yes'
    else:
        ans = 'No'

    print(ans)

if __name__ == '__main__':
    solve()

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


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

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

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

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

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

for i in group1:
    table[i] = 1

for i in group2:
    table[i] = 2

for i in group3:
    table[i] = 3

[x, y] = map(int, raw_input().strip().split())
if table[x] == table[y]:
    print "Yes"
else:
    print "No"

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

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

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

N = [int(i) for i in input().split()]

for i in range(2):
	a[i] = N[i] in listA
	b[i] = N[i] in listB
	c[i] = N[i] in listC


if a[0] == True and a[1] == True:
	print ("Yes")
elif b[0] == True and b[1] == True:
	print ("Yes")
elif c[0] == True and c[1] == True:
	print ("Yes")
else:
	print ("No")

Solution (Python):
x=[int(i) for i in input (). split ()]
g=[0,0]
for i in range(len(x)):
    if x[i]==2:
        g[i]=2
    elif x[i]==4 or x[i]==6 or x[i]==9 or x[i]==11:
        g[i]=1
if g[0]==g[1]:
    print ("Yes")
else:
    print ("No")

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

a, b = map(int,raw_input().split())
if a in l1 and b in l1:
	print "Yes"
elif a in l2 and b in l2:
	print "Yes"
elif a in l2 and b in l3:
	print "Yes"
else :
	print "No"

Solution (Python):
x, y = map(int, input().split())
A = [1,3,5,7,8,10,12]
B = [2,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())
t1 = [1,3,5,7,8,10,12]
t2 = [4,6,9,11]
t3 = [2]

if x in t1 and y in t1:
    print("Yes")
elif x in t2 and y in t2:
    print("Yes")
elif x in t3 and y in t3:
    print("Yes")
else:
    print("No")

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

listA = [1, 3, 5, 7 , 8 , 10 , 12]
listB = [4 , 6, 9, 11]
listC=[2]

if x in listA and y in listA:
    print("Yes")
    
elif x in listB and y in listB:
    print("Yes")
    
elif x in listC and y in listC:
    print("Yes")
    
else:
    print("No")

Solution (Python):
x,y=map(int,input().split())
a = [i for i in range(1,13)]
b = [0,2,0,1,0,1,0,0,1,0,1,0]
c = dict(zip(a,b))
print('Yes' if c[x]==c[y] else 'No')

Solution (Python):
l = raw_input().split(" ")



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

ans="No"


if (int(l[0]) in a and int(l[1]) in a):
    ans="Yes"

if (int(l[0]) in b and int(l[1]) in b):
    ans="Yes"

if (int(l[0]) in c and int(l[1]) in c):
    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())
if (x in a and y in a) or (x in b and y in b):
    print('Yes')
else:
    print('No')

Solution (Python):
x=[int(i) for i in input (). split ()]
g=[0,0]
for i in range(len(x)):
    if x[i]==2:
        g[i]=2
    elif x[i]==4 or x[i]==6 or x[i]==9 or x[i]==11:
        g[i]=1
if g[0]==g[1]:
    print ("Yes")
else:
    print ("No")

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

Solution (Python):
import numpy as np

data = input()
data = data.split()
x = int(data[0])
y = int(data[1])

vec_1 = []
vec_2 = []
group = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]


for i in range(3):
	if x in group[i]:
		vec_1.append(1)
	else:
		vec_1.append(0)

for i in range(3):
	if y in group[i]:
		vec_2.append(1)
	else:
		vec_2.append(0)

vec_1 = np.array(vec_1)
vec_2 = np.array(vec_2)


if sum(vec_1 * vec_2) == 1:
	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]

group = [g1, g2, g3]

flag = False
for g in group:
    if x in g and y in g:
        print("Yes")
        flag = True

if flag == False:
    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):
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")

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

Solution (Python):
def solve() :
    ri = raw_input()

    inarr = ri.split(' ')
    a = inarr[0]
    b = inarr[1]

    if a in ['2'] :
        return ( b == '2')
    elif a in ['4','6','9','11'] :
        return ( b in ['4','6','9','11'])
    else :
        return ( b in ['1','3','5','7','8','10','12'])

if __name__ == '__main__':
     if solve() : print 'Yes'
     else : print 'No'

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

Solution (Python):
data = input().split()
x = int(data[0])
y = int(data[1])

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 = list(map(int,input().split()))
data = [(1,3,5,7,8,10,12),(4,6,9,11),(2,0)]
a = 0
def group(x,y,a):
    for i in range(3):
        if x in data[i]:
            if y in data[i]:
                print("Yes")
                a = 1
                break
    if a == 0:
        print("No")
group(x,y,a)

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

Solution (Python):
import sys

s = [1,3,5,7,8,10,12]
t = [4,6,9,11]
r = [2]

arg = raw_input()
x = int(arg.split(" ")[0])
y = int(arg.split(" ")[1])

if (x in s and y in s) or (x in t and y in t) or (x in r and y in r):
    print "Yes";
else:
    print "No";

Solution (Python):
x,y=map(int,raw_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==y==2:
    print "Yes"
else:
    print "No"

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

if x == 2 :
  print ('No')

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

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

Solution (Python):

 
import sys
 
G1 = [1, 3, 5, 7, 8, 10, 12]
G2 = [4, 6, 9, 11]
 
x,y = input().strip().split(' ')
x,y = [int(x),int(y)]
 
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())
f = [0] * 15
f[1] = f[3] = f[5] = f[7] = f[8] = f[10] = f[12] = 1
f[4] = f[6] = f[9] = f[11] = 2
print('Yes' if f[x] == f[y] else 'No')

Solution (Python):
def grouping():
	s1 = {1, 3, 5, 7, 8, 10, 12}
	s2 = {4, 6, 9, 11}
	s3 = {2}

	s4 = set(map(int, input().split()))

	for s in [s1, s2, s3]:
		if s & s4 == s4:
			print('Yes')
			return 0

	print('No')
	return 0

if __name__ == '__main__':
	grouping()

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

nums = [int(x) for x in input().split()]
a = nums[0]
b = nums[1]

for group in [A,B,C]:
	if a in group:
		if b in group:
			print("Yes")
			sys.exit()

print("No")

Solution (Python):


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

Solution (Python):
import sys
import random

def rd():
        return sys.stdin.readline().rstrip()

def rdi():
        return [ int(x) for x in rd().split() ]

G = { 1:1, 3:1, 5:1, 7:1, 8:1, 10:1, 12:1,
        4:2, 6:2, 9:2, 11:2,
        2:3 }

x, y = rdi()

if G[x] == G[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 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(x) for x in input().split()]

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

if x in list1:
	if y in list1:
		print("Yes")
	else:
		print("No")
elif x in list2:
	if y in list2:
		print("Yes")
	else:
		print("No")
else:
	if y in list3:
		print("Yes")
	else:
		print("No")

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

Solution (Python):
def main():
    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:
        ans = 'Yes'
    elif X in grp2 and Y in grp2:
        ans = 'Yes'
    else:
        ans = 'No'

    print(ans)

main()

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

Solution (Python):


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

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

for i in range(3):
    if x in A[i]:
        xx=i
    if y in A[i]:
        yy=i

if xx==yy:
    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}
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):
s = input()
s = s.split()


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

if(int(s[0]) in a and int(s[1]) in a):
    print("Yes")
elif(int(s[0]) in b and int(s[1]) in b):
    print("Yes")
elif(int(s[0]) in c and int(s[1]) in c):
    print("Yes")
else:
    print("No")

Solution (Python):
if __name__ == "__main__":

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

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

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

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

else:
 print("No")

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

t = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
if t[a - 1] == t[b - 1]:
    print("Yes")
else:
    print("No")

Solution (Python):

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

set1 = [1, 3, 5, 7, 8, 10, 12]
set2 = [4, 6, 9, 11]
set3 = [2]


if x in set1:
    if y in set1:
        print('Yes')
    else:
        print('No')
elif x in set2:
    if y in set2:
        print('Yes')
    else:
        print('No')
elif x == 2:
    if y == 2:
        print('Yes')
    else:
        print('No')

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

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

for g in x:
  if a in g:
    if b in g:
      print('Yes')
    else:
      print('No')

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

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

li = input().split()
x = int(li[0])
y = int(li[1])

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

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

groups = [group1, group2, group3]

def check():
    for i in range(3):
        if a in groups[i] and b in groups[i]:
            print('Yes')
            return
    print('No')

check()

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

s = input().split(' ')
x = int(s[0])
y = int(s[1])
lx = list(map(lambda a: x in a, g))
ly = list(map(lambda b: y in b, g))
if lx==ly:
    print('Yes')
else:
    print('No')

Solution (Python):
n = input()
tmp_n = n.split(" ")

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

if int(tmp_n[0]) in list1 and int(tmp_n[1]) in list1:
    print("Yes")
elif int(tmp_n[0]) in list2 and int(tmp_n[1]) in list2:
    print("Yes")
elif int(tmp_n[0]) in list3 and int(tmp_n[1]) in list3:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):

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

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

xg = 0
yg = 0

if x in g1:
    xg = 1
elif x in g2:
    xg = 2
elif x in g3:
    xg = 3

if y in g1:
    yg = 1
elif y in g2:
    yg = 2
elif y in g3:
    yg = 3

if xg == yg:
    print 'Yes'
else:
    print 'No'

Solution (Python):

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

def get_g(x):
	g = 0
	if x in gA:
		g = 0

	if x in gB:
		g = 1

	if x in gC:
		g = 2
	return g

inputs = input().split(" ")
ix = int(inputs[0])
iy = int(inputs[1])

if get_g(ix) == get_g(iy):
	print("Yes")
else:
	print("No")

Solution (Python):


def main():
    x,y = [int(s) for s in input().split()]
    
    g1 = [1,3,5,7,8,10,12]
    g2 = [4,6,9,11]
    g3 = [2]

    res = False
    for g in (g1,g2,g3):
        
        if x in g and y in g:
            res = True

    if res: 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) 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):


import sys
import math

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

def find_group(i):
    for index, group in enumerate(sets):
        if i in group:
            return index


x,y = map(int, sys.stdin.readline().rstrip().split())

if (find_group(x) == find_group(y)):
    print("Yes")
else:
    print("No")

exit(0)

Solution (Python):

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

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

flag = 0
for i in range(len(a)):
    if a[i] == x:
        flag = 1

for i in range(len(b)):
    if b[i] == x:
        flag = 2

for i in range(len(c)):
    if c[i] == x:
        flag = c

result = 0        
if flag == 1:
    for i in range(len(a)):
        if a[i] == y:
            result = 1
elif flag == 2:
    for i in range(len(b)):
        if b[i] == y:
            result = 1
elif flag == 3:
    for i in range(len(c)):
        if c[i] == y:
            result = 1

if result == 1:
    print('Yes')
elif result == 0:
    print('No')

Solution (Python):
def rren(): return list(map(int, input().split()))


a = ["1 3 5 7 8 10 12".split(), "4 6 9 11".split(), ["2"]]

x, y = rren()
flag = False
for i in range(3):
    if(str(x) in a[i] and str(y) in a[i]):
        flag = True

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

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

groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
is_same_group = False
for group in groups:
    if x in group and y in group:
        is_same_group = True
        break

if is_same_group:
    print('Yes')
else:
    print('No')

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

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

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

if x in A:
    g_x = "A"
elif x in B:
    g_x = "B"
else:
    g_x = "C"

if y in A:
    g_y = "A"
elif y in B:
    g_y = "B"
else:
    g_y = "C"

if g_x == g_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 in c and y in c):
    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')