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

g = [0,1,3,1,2,1,2,1,1,2,1,2,1]
if g[x] == g[y]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if(x==2):
  x=3
elif(x==4 or x==6 or x==9 or x==11):
  x=2
else:
  x=1
if(y==2):
  y=3
elif(y==4 or y==6 or y==9 or y==11):
  y=2
else:
  y=1

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x, y = map(int, raw_input().split())
#a, b, c = 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 in c and y in c):
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
x,y=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 = list(map(lambda x: int(x), 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 = [int(i) for i in input().split()]
set1 = [1,3,5,7,8,10,12]
set2 = [4,6,9,11]
set3 = [2]
if (x in set1 and y in set1) or (x in set2 and y in set2):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

l = [0, 0, 0]

if(a == 1 or a == 3 or a == 5 or a == 7 or a == 8 or a == 10 or a == 12):
    l[0] = 1
elif(a == 2):
    l[2] = 1
else:
    l[1] = 1

if((b == 1 or b == 3 or b == 5 or b == 7 or b == 8 or b == 10 or b == 12)
   and l[0]):
    print("Yes")
elif(b == 2 and l[2]):
    print("Yes")
elif((b == 4 or b == 6 or b == 9 or b == 11) and l[1]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

"""      0123456789ABC"""
magic = '-xzxyxyxxyxyx'

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

Submission status: Accepted

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

G1=[1,3,5,7,8,10,12]
G2=[4,6,9,11]
G3=[2]

if (a in G1 and b in G1) or (a in G2 and b in G2) or (a in G3 and b in G3):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

G = (
    None,
    0, 2, 0, 1, 0,
    1, 0, 0, 1, 0,
    1, 0,
)

def main():
    X, Y = map(int, input().split())
    ok = G[X] == G[Y]
    print("Yes" if ok else "No")

if __name__ == "__main__": main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=[[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y=map(int,input().split())
for i in a:
    if x in i and y in i:
        print('Yes')
        quit()
        
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:
from calendar import monthrange as mh
x, y = map(int, input().split())
if mh(2017,x)[-1] == mh(2017,y)[-1]: print('Yes')
else: print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(["Yes","No"][len(set("XACABABAABABA"[int(x)] for x in input().split()))-1])

Submission status: Accepted

Solution code:
print(["","Yes","No"][len(set("XACABABAABABA"[int(x)] for x in input().split()))])

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]
print(['No','Yes'][x in a and y in a or x in b and y in b or x in c and y in c])

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):
    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:
a, b = map(int,input().split())
p = [1,3,5,7,8,10,12]
q = [4,6,9,11]
if a == b:
    print("Yes")
else:
    if a in p and b in p:
        print("Yes")
    elif a in q and b in q:
        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:
#!/usr/bin/env python

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

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

def getGroup(num):
    if(num==2):
        return 3;
    for i in g2:
        if(i==num):
            return 2;
    return 1;

if(getGroup(x)==getGroup(y)):
    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 = list(map(int, input().split()))
if(x in a and y in a or x in b and y in b or x in c and y in c):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if x in list1 and y in list1:
	print('Yes')
	
elif x in list2 and y in list2:
	print('Yes')
	
elif x in list3 and y in list3:
	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]
list3 = [2]

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

Submission status: Accepted

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

a = [1, 3, 5, 7, 8, 10, 12]

b = [4, 6, 9, 11]

if x == 2 or y == 2:
    if x == 2 and y == 2:
        print 'Yes'
    else:
        print 'No'
else:
   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 = map(int, raw_input().split())
x=l[0]
y=l[1]

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

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

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

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


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:
print(['No','Yes'][(lambda a,b:a[b[0]-1]==a[b[1]-1])([0,2,0,1,0,1,0,0,1,0,1,0],list(map(int,input().split())))])

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

Submission status: Accepted

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

Submission status: Accepted

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

if (x in L and y in L) or (x in M and y in M) or (x in N and y in N):
    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, raw_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:
x,y = list(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())
lst1 = [1,3,5,7,8,10,12]
lst2 = [4,6,9,11]
if (x in lst1) and (y in lst1):
    print("Yes")
elif (x in lst2) and (y in lst2):
    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 = [int(n) for n in input().split()]

if (x in l1 and y in l1) or (x in l2 and y in l2):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
def solve(): # Grouping
    while 1:
        x, y = list(map(int, input().split(" ")))
        if x == 2 or y == 2:
            print("No")
            break
        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")

        break


solve()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://abc062.contest.atcoder.jp/tasks/abc062_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    group1 = [1, 3, 5, 7, 8, 10, 12]
    group2 = [4, 6, 9, 11]
    # group3 = [2]

    ans = 'No'
    x, y = map(int, input().split())
    if x in group1 and y in group1:
        ans = 'Yes'
    elif x in group2 and y in group2:
        ans = 'Yes'
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
x, y = map(int, raw_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"

Submission status: Accepted

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

Submission status: Accepted

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

def calc(x):
    if x == 2:
        return  -1
    elif  x == 4 or x == 6 or x == 9 or x == 11:
        return  -2
    else:
        return  -3

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
gr = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]

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

if gr[x - 1] == gr[y - 1]:
    print('Yes')
else:
    print('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]
if a.count(x) and a.count(y):
    print('Yes')
elif b.count(x) and b.count(y):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:



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

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

x = whichone(x)
y = whichone(y)

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

Submission status: Accepted

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

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:
import calendar
a, b = map(int, input().split())
if calendar.monthrange(2017, a)[1] == calendar.monthrange(2017, b)[1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
d = {1: 1, 2: 2, 3: 1, 4: 3, 5: 1, 6: 3, 7: 1, 8: 1, 9: 3, 10: 1, 11: 3, 12: 1}
x, y = map(int, input().split())

if d[x] == d[y]:
    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())

def jj(n):
        if n in a:
            return 1
        if n in b:
            return 2
        if n in c:
            return 3

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

Submission status: Accepted

Solution code:
x,y=[int(x) for x in input().split()]
def check(s):
    for i in s:
        if x in i and y in i:
            return True
    return False
if check([[1,3,5,7,8,10,12],[2],[4,6,9,11]]):
    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]

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

def judge(d):
    if (d[0] in a) and (d[1] in a):
        print("Yes")
    elif (d[0] in b) and (d[1] in b):
        print("Yes")
    elif (d[0] in b) and (d[1] in b):
        print("Yes")
    else:
        print("No")

judge(d)

Submission status: Accepted

Solution code:
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]

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

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

Submission status: Accepted

Solution code:
group_list = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

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

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

Submission status: Accepted

Solution code:
def main():
    d = dict()
    for i in range(1, 13):
        if i == 2:
            d[i] = 'a'
        elif i in [4, 6, 9, 11]:
            d[i] = 'b'
        else:
            d[i] = 'c'

    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
input = map(int, raw_input().split())
group1 = [1,3,5,7,8,10,12]
group2 = [4,6,9,11]
group3 =  [2]

syozoku = [0,0]

for i in range(2):
	if input[i] in group1:
		syozoku[i] = 1
	elif input[i] in group2:
		syozoku[i] = 2
	elif input[i] in group3:
		syozoku[i] = 3

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

Submission status: Accepted

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

if x in g1 and y in g1:
    print('Yes')
elif x in g2 and y in g2:
    print('Yes')
elif x in g3 and y in g3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
group = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

x, y = map(int, input().split())
ans = "Yes" if(group[x] == group[y]) else "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if (x in lst1)==1 and (y in lst1)==1:
    print("Yes")
elif (x in lst2)==1 and (y in lst2)==1:
    print("Yes")
elif x==2 and y==2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

for i in range(3):
    if x in group_list[i]:
        if y in group_list[i]:
            print("Yes")
        else:
            print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, 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")
elif x in GroupC and y in GroupC:
    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) & (y in A)) or ((x in B) & (y in B)) or ((x in C) & (y in C)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x,y =map(int,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:
    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, y = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
count = 0
ax = x in A
ay = y in A
bx = x in B
by = y in B
if ax == True and ay == True:
    print("Yes")
elif bx == True and by == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
ga={1, 3, 5, 7, 8, 10, 12}
gb={4, 6, 9, 11}
gc={2}
cin = input().split()
gx={int(cin[0])}
gy={int(cin[1])}
if gx <= ga and gy <= ga:
    print('Yes')
elif gx <= gb and gy <= gb:
    print('Yes')
elif gx <= gc and gy <= gc:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a=input().split()
x=int(a[0])
y=int(a[1])
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
count =0
for i in A:
 if(x==i):
  count +=1
 if(y==i):
  count +=1
for i in B:
 if(x==i):
  count -=1
 if(y==i):
  count -=1
if((count==2)or(count==-2)):
 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:
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")

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    d = {"A": (1, 3, 5, 7, 8, 10, 12), "B": (4, 6, 9, 11), "C": (0, 2)}
    x, y = map(int, input().split())
    a, b = None, None
    for k, v in d.items():
        if x in v:
            a = k
        if y in v:
            b = k
    print("Yes" if a == b else "No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

finished = False
for gl in group_list:
    if (x in gl) and (y in gl):
        print("Yes")
        finished = True
if finished != True:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a=set([1,3,5,7,8,10,12])
b=set([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:
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 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 = [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")
elif x in groupC and y in groupC:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
M = {2: 0, 4: 1, 6: 1, 9: 1, 11: 1}
x, y = map(int, raw_input().split())
print 'Yes' if M.get(x, 2) == M.get(y, 2) else 'No'

Submission status: Accepted

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

s = map(int, raw_input().split())

x = s[0]
y = s[1]

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:
def main():
    x, y = list(map(int, input().strip().split()))
    groups = [
        [1, 3, 5, 7, 8, 10, 12],
        [4, 6, 9, 11],
        [2]
    ]
    answer = "No"
    for g in groups:
        if x in g and y in g:
            answer = "Yes"
            break
    print(answer)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

x,y = map(int,(input().split()))
cou1 = 0
cou2 = 0

for i in a:
    if i==x or i==y:
        cou1 += 1
for i in b:
    if i==x or i==y:
        cou2 += 1

if cou1>1 or cou2>1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
x, y = [int(i) for i in input().split()]
list = [1,3,5,7,8,10,12,4,6,9,11,2,0]
slice1 = list[0:7]
slice2 = list[7:11]
slice3 = list[11:12]

if x in slice1 and y in slice1:
    print('Yes')
elif x in slice2 and y in slice2:
    print ('Yes')
elif x in slice3 and y in slice3:
    print ('Yes')
else:
    print ('No')

Submission status: Accepted

Solution code:
#Python

G1=[1,3,5,7,8,10,12]
G2=[4,6,9,11]
G3=[2]

N = map(int, raw_input().split())
#print N


if N[0] in G1 and N[1] in G1:
	print 'Yes'
elif N[0] in G2 and N[1] in G2:
	print 'Yes'
elif N[0] in G3 and N[1] in G3:
	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]
group3 = [2]

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

Submission status: Accepted

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

Submission status: Accepted

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

S={X,Y}

S1={1,3,5,7,8,10,12}
S2={4,6,9,11}
S3={2}

if len(S1)==len(S1|S):
    print("Yes")
elif len(S2)==len(S2|S):
    print("Yes")
elif len(S3)==len(S3|S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

def solve():
    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 in [2] and y in [2]:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import sys

# sys.stdin = open("a1.in")


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

l = [a, b, c]
g = {}
for i in range(3):
    for j in l[i]:
        g[j] = i
if g[x] == g[y]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
group =[0,1,3,1,2,1,2,1,1,2,1,2,1]

input_lines=raw_input()
input_numbers=input_lines.split()
n=map(int,input_numbers)

if group[n[0]] == group[n[1]]:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
#coding: utf-8

group={'a':[1,3,5,7,8,10,12],'b':[4,6,9,11],'c':[2]}

input_lines=raw_input()
input_numbers=input_lines.split()
n=map(int,input_numbers)#n[0]とn[1]に数字

first_group = False
second_group = False

for i in group:
    for j in range(0,len(group[i])):
        if group[i][j] == n[0]:
            first_group = True
        if group[i][j] == n[1]:
            second_group = True
    if first_group == True and second_group==False or first_group == False and second_group == True:
        print "No"
        break

if first_group and second_group:
    print "Yes"

Submission status: Accepted

Solution code:
import sys

# sys.stdin = open("a1.in")


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:
    gx = 1
if x in b:
    gx = 2
if x in c:
    gx = 3
if y in a:
    gy = 1
if y in b:
    gy = 2
if y in c:
    gy = 3

if gx == gy:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A = set([1, 3, 5, 7, 8, 10, 12])
B = set({4, 6, 9, 11})
C = set({2})
D = set(map(int, raw_input().split()))
if A.issuperset(D) or B.issuperset(D) or C.issuperset(D):
    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, raw_input().split())

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:
    if 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]
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:
n_to_cluster = {}
for n in [1, 3, 5, 7, 8, 10, 12]:
    n_to_cluster[n] = 0
for n in [4, 6, 9, 11]:
    n_to_cluster[n] = 1
for n in [2]:
    n_to_cluster[n] = 2

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

Submission status: Accepted

Solution code:
#!/bin/usr/python

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

x,y = [int(i) for i in 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,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")
else:
    print("No")

Submission status: Accepted

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

indata = raw_input().split()

def search(no):
    index = 0
    for g in grp:
        for i in g:
            if no == str(i):
                return index
        index = index + 1
    return None
            
first = search(indata[0])

second = search(indata[1])
if first == second:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
#coding:utf-8

l = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = [int(x) for x in input().split()]
print('Yes' if l[x] == l[y] else 'No')

Submission status: Accepted

Solution code:
# _*_ coding: utf-8_*_
import sys

is_ingroup = False

input = sys.stdin.readline()

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

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

for i in range(len(group)):
	if x in group[i] and y in group[i]:
		is_ingroup = True

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

Submission status: Accepted

Solution code:

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

groups = []
groups.append([1, 3, 5, 7, 8, 10, 12])
groups.append([4, 6, 9, 11])
groups.append([2])

for g in groups:
    if x in g and y in g:
        print "Yes"
        break
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:
    if y in A:
        print("Yes")
    else:
        print("No")
if x in B:
    if y in B:
        print("Yes")
    else:
        print("No")
if x in C:
    if y in C:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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


def main():
    x, y = map(int, input().split())
    for gx in g:
        if x in gx and y in gx:
            print('Yes')
            return
    print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

# check group
def check(z):
    if z in C:
        return 'C'
    elif z in B:
        return 'B'
    else:
        return 'A'

group_x = check(x)
group_y = check(y)

if group_x == group_y:
    print('Yes')
else:
    print('No')