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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
t = [0]*13
t[4] = t[6] = t[9] = t[11] = 1
t[2] = 2
print('Yes' if t[x] == t[y] else '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 in group1 and y in group1:
  print('Yes')
elif x in group2 and y in group2:
  print('Yes')
elif x == y == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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 == 2:
    if y == 2:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
X, Y = 0, 0
l = [4, 6, 9, 11]
if x == 2:
  X = 3
elif x in l:
  X = 2
else:
  X = 1
if y == 2:
  Y = 3
elif y in l:
  Y = 2
else:
  Y = 1
if X == 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())
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=list(map(int, input().split()))
s=[[1,3,5,7,8,10,12],[4,6,9,11],[2]]
ans=[]
for i in a:
  for j in range(len(s)):
    if i in s[j]:
      ans.append(j)
      break
if len(set(ans))==1:
  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 == 2 and y == 2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

x,y=MI()
ind=[0,2,0,1,0,1,0,0,1,0,0,1]
if ind[x-1]==ind[y-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
group = 'acababaababa'
print('Yes' if group[x-1] == group[y-1] else 'No')

Submission status: Accepted

Solution code:
import sys
x,y=map(int, input().split())
if x==2 or y==2:
  print('No')
  sys.exit()

a=[4,6,9,11]
if (x in a) and (y in a):
  print('Yes')
elif (x not in a) and (y not in a):
  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=[2]
c=[4,6,9,11]
if x in a and y in a:
  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())

g = [0,2,0,1,0,1,0,0,1,0,1,0]
if g[a-1] == g[b-1]:
  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]
print("Yes" if (x in l1 and y in l1) or (x in l2 and y in l2) else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def resolve():
    x, y = list(map(int, input().split()))
    groups = [[1, 3, 5, 7, 8, 10, 12],
              [4, 6, 9, 11],
              [2]]
    for group in groups:
        if x in group and y in group:
            print("Yes")
            return
    print("No")
    


if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


def group(v):
    if v in [1, 3, 5, 7, 8, 10, 12]:
        return 1
    elif v == 2:
        return 2
    else:
        return 3


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

Submission status: Accepted

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

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

if x_y<set1:
    print("Yes")
elif x_y<set2:
    print("Yes")
elif x_y<set3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
group = [[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 group[i] and y in group[i]:
        print("Yes")
        exit()
    
print("No")

Submission status: Accepted

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

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

if x in a and y in a:
  print("Yes")
elif x in b and y in b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt1 = 0
for i in range(len(val1)):
    if val1[i] == x or val1[i] == y:
        cnt1 += 1

cnt2 = 0
for i in range(len(val2)):
    if val2[i] == x or val2[i] == y:
        cnt2 += 1

if cnt1 == 2 or cnt2 == 2:
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
x, y = map(int, input().split())
x -= 1
y -= 1
if a[x] == a[y]:
    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")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ax = 0
ay = 0

if x in X:
  ax = 1
elif x in Y:
  ax = 2
else:
  ax = 3
if y in X:
  ay = 1
elif y in Y:
  ay = 2
else:
  ay = 3
  
print('Yes') if ax == ay 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{2} and b in {2}:
    print("Yes")
elif a in {4,6,9,11} and b in {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]

x, y = map(int, input().split())
ans = "No"
for group in [A, B, C]:
  if x in group and y in group:
    ans = "Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

for group in groups:
    if x in group and y in group:
        print('Yes')
        break
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:
S = 'XACABABAABABA'
x, y = map(int, input().split())
print('Yes' if S[x] == S[y] else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = '0acababaababa'
x,y = map(int, input().split())
if s[x]==s[y]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if (x in A and y in A) or (y in B and x in B):
  print("Yes")
  
else:
  print("No")

Submission status: Accepted

Solution code:
def main():
    group_A = [1, 3, 5, 7, 8, 10, 12]
    group_B = [4, 6, 9, 11]
    group_C = [2]

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

    x_id = 0
    y_id = 0

    if x in group_A:
        x_id = 1
    elif x in group_B:
        x_id = 2
    elif x in group_C:
        x_id = 3

    if y in group_A:
            y_id = 1
    elif y in group_B:
        y_id = 2
    elif y in group_C:
        y_id = 3

    if x_id == y_id:
        print("Yes")
    else:
        print("No")

main()

Submission status: Accepted

Solution code:
x,y = map(int, input().split())
if x==2 or y==2:
  print("No")
  exit()

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

Submission status: Accepted

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

group1 = [1, 3, 5, 7, 8, 10]
group2 = [4, 6, 9, 11]
group3 = [2]

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

Submission status: Accepted

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

G = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
for g in G:
    if x in g and y in g:
        print('Yes')
        exit()
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 A.count(x)==1:
  flagX=1
elif B.count(x)==1:
  flagX=2
else:
  flagX=3

if A.count(y)==1:
  flagY=1
elif B.count(y)==1:
  flagY=2
else:
  flagY=3

if flagX==flagY:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a = {"1":[1,3,5,7,8,10,12],"2":[4,6,9,11],"3":[2]}

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

for k in a.keys():  
    if x in a[k]:
        xi = k
    if y in a[k]:
        yi = k
if xi == yi:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
G = [0] * 13
for i in [4, 6, 9, 11]:
    G[i] = 1
G[2] = 2

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def g(x):
  if x==2:
    return 1
  if x in [4, 6, 11, 9]:
    return 2
  return 3

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

if a.count(x) > 0 and a.count(y) > 0:
  print('Yes')
elif b.count(x) > 0 and b.count(y) > 0:
  print('Yes')
elif c.count(x) > 0 and c.count(y) > 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())

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

if (n in a and m in a) or (n in b and m in b):print('Yes')
  
else:print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
list2 = [4, 6, 9, 11]

if x == 2 or y == 2:
    print('No')
else:
    if x in list2 and y in list2:
        print('Yes')
    else:
        if x not in list2 and y not in list2:
            print('Yes')
        else:
            print('No')

Submission status: Accepted

Solution code:
X = {1, 3, 5, 7, 8, 10, 12}
Y = {4, 6, 9, 11}
Z = {2}

L = list(map(int, input().split()))
S = set(L)
if len(X-S)==5 or len(Y-S)==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) 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:
p = "_acababaababa"
x, y = map(int, input().split())
print("YNeos"[p[x]!=p[y]::2])

Submission status: Accepted

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

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:
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:
  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=[int(i) for i in input().split()]
ans=0
biglist=[a,b,c]
for group in biglist:
    if (x in group) and (y in group):
        ans+=1
        
if ans==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=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 == y:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    x, y = il()
    p1 = [1, 3, 5, 7, 8, 10, 12]
    p2 = [4, 6, 9, 11]
    p3 = [2]
    print('Yes' if x in p1 and y in p1 or x in p2 and y in p2 or x in p3 and y in p3 else 'No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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]

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 = [int(i) for i in input().split()]

gr = [4,6,9,11]
gr2 = [1,3,5,7,8,10,12]

if (x ==2) | (y ==2):
    print("No")
    
elif (x in gr) & (y in gr):
    print("Yes")
elif (x in gr2) & (y in gr2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
A={1,3,5,7,8,10,12}
B={4,6,9,11}
if {x,y} < A:
    print('Yes')
elif {x,y} < B:
    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())
ans = '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:
    ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
def main():
  L1 = [1,3,5,7,8,10,12]
  L2 = [4,6,9,11]
  L3 = [2]
  ans = False
  x,y = map(int,input().split())
  if L1.count(x) == 1 and L1.count(y)==1:
    ans = True
  if L2.count(x) == 1 and L2.count(y) == 1:
    ans = True
  if L3.count(x) == 1 and L3.count(y) == 1:
    ans = True
  print("Yes" if ans else "No")
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc062/tasks/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')

Submission status: Accepted

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

Submission status: Accepted

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

set1 = {4,6,9,1}
set2 = {1,3,5,7,8,10,12}

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

Submission status: Accepted

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

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

if x in la and y in la:
  print('Yes')
elif x in lb and y in lb:
  print('Yes')
elif x in lc and y in lc:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys

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

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

def main():
    ans = 'Yes' if group[x] == group[y] else 'No'
    print(ans)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

group = [None, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

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

def main():
    ans = 'Yes' if group[x] == group[y] else 'No'
    print(ans)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

Solution code:
# ABC 062: A – Grouping
groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
x, y = [int(s) for s in input().split()]
print('Yes' if (x in groups[0] and y in groups[0]) or (x in groups[1] and y in groups[1]) or (x in groups[2] and y in groups[2]) else '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]

tmp = a in listb

# print(tmp)

if (a == 2 and b ==2):
    print("Yes")
elif (a in listb and b in listb):
    print("Yes")
elif (a in lista and b in lista):
    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:
    print("Yes")
elif x in b and y in b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
x,y = iim()

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

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    g1 = [1,3,5,7,8,10,12]
    g2 = [4,6,9,11]
    g3 = [2]

    a1=0
    a2=0

    if a[0] in g1:
        a1 =1
    elif a[0] in g2:
        a1 =2
    else:
        a1=3

    if a[1] in g1:
        a2 =1
    elif a[1] in g2:
        a2 =2
    else:
        a2=3

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if (x in A and y in A) or (x in B and y in B) or (x in C and y in C):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

if x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12:
  x = "a"
elif x == 4 or x == 6 or x == 9 or x == 11:
  x = "b"
if y == 1 or y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
  y = "a"
elif y == 4 or y == 6 or y == 9 or y == 11:
  y = "b"

if x == y:
  print("Yes")
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())
c = 0
for i in range(3):
    if x in a[i] and y in a[i]:
        c = 1
print("Yes" if c == 1 else "No")

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

import calendar

x, lastday_x = calendar.monthrange(2020,x)
y, lastday_y = calendar.monthrange(2020,y)

if lastday_x == lastday_y:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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