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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#   "123456789012"
g = " ACABABAABABA"
x, y = map(int, input().split())
print("Yes" if g[x] == g[y] else "No")

Submission status: Accepted

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

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

if x in g_1:
    if y in g_1:
        print("Yes")
    else:
        print("No")
if x in g_2:
    if y in g_2:
        print("Yes")
    else:
        print("No")
if x in g_3:
    if y in g_3:
        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 = map(int,input().split())

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

Submission status: Accepted

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

x,y = map(int,input().split())
if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    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 a.count(x) > 0:
  x = a
elif b.count(x) > 0:
  x = b
else:
  x = c
if a.count(y) > 0:
  y = a
elif b.count(y) > 0:
  y = b
else:
  y = c
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]
flag = 0
x, y = map(int, input().split())
if x in a:
    if y in a:
        flag = 1
if x in b:
    if y in b:
        flag = 1
if x in c:
    if y in c:
        flag = 1
print("Yes") if flag == 1 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 )

if x in X and y in X:
    print('Yes')

elif x in Y and y in 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, )

for g in (a, b, c):
  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())
gr1 = [2]
gr2 = [4,6,9,11]
if x in gr1:
  x_gr = 1
elif x in gr2:
  x_gr = 2
else:
  x_gr = 3
if y in gr1:
  y_gr = 1
elif y in gr2:
  y_gr = 2
else:
  y_gr = 3
if x_gr == y_gr:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
i = [1,3,5,7,8,10,12]
j = [4,6,9,11]
k = [2]
if x in i and y in i:
    print('Yes')
elif x in j and y in j:
    print('Yes')
elif x in k and y in k:
    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:
x, y = map(int, input().split())
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
if (x in g1 and y in g1) or (x in g2 and y in g2):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
one = [1,3,5,7,8,10,12]
two = [2]
three = [4,6,9,11]
kazu = list(map(int, input().split()))
iti = 0
ni = 0
san = 0
for k in kazu:
  if k in one:
    iti += 1
  elif k in two:
    ni += 1
  elif k in three:
    san += 1
if iti == 2 or ni == 2 or san == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def judge(x):
  if x==4 or x==6 or x==9 or x==11:
    y = 'a'
  elif x==2:
    y = 'b'
  else:
    y = 'c'
  return y
 
a,b = map(int,input().split())
if judge(a) == judge(b) :
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s='0121313113131'
x,y=map(int,input().split())
print('YNeos'[s[x]!=s[y]::2])

Submission status: Accepted

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

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

for g in G:
    if x in g and y in g:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

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

group_a = {1,3,5,7,8,10,12}
group_b = {4,6,9,11}
group_c = {2}

if (x in group_a and y in group_a) or (x in group_b and y in group_b):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

# solve
ans = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

# output
print('Yes' if ans[x] == ans[y] else '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]
ans = 'No'
if (x in l1 and y in l1) or (x in l2 and y in l2) or (x in l3 and y in l3):
  ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
a = [1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
x, y = MAP()
if a[x - 1] == a[y - 1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s='0121313113131'
x,y=map(int,input().split())
print('YNeos'[s[x]!=s[y]::2])

Submission status: Accepted

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

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

flag = False
for g in [A, B, C]:
  if (x in g and y in g):
    flag = True
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

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

xg = ''
yg = ''

for i in alist:
    if i == x:
        xg = 'A'

    if i == y:
        yg = 'A'

for i in blist:
    if i == x:
        xg = 'B'

    if i == y:
        yg = 'B'

for i in clist:
    if i == x:
        xg = 'C'

    if i == y:
        yg = 'C'

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    x, y = LI()
    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")
        return
    if x in b and y in b:
        print("Yes")
        return
    if x in c and y in c:
        print("Yes")
        return
    print("No")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

def main():
    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')

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]
if(x in A and y in A):
    print("Yes")
elif(x in B and y in B):
    print("Yes")
elif(x==y==2):
    print("Yes")
else:
    print("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:
    if y in l:
        print("Yes")
        import sys
        sys.exit()
if x in m:
    if y in m:
        print("Yes")
        import sys
        sys.exit()
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]
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:
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:
#!/usr/bin/env python3
#ABC62 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:
    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 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 == 2 or  y == 2:
    print ("No")

elif ( x in A and y in A) or ( x in B and y in B ):
    print ( "Yes" )

else:
    print ( "No" )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int,input().split())
#ls = list(map(int,input().split()))
#r = int(input())
#s = input()
#x, y = input().split()

ls = [4,6,9,11]

if (ls.count(x) == 1 and ls.count(y) == 1) or (x == 2 and y == 2) or (ls.count(x) != 1 and x != 2 and y != 2 and ls.count(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:
    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())

group_a = [1, 3, 5, 7, 8, 10, 12]
group_b = [4, 6, 9, 11]

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

Submission status: Accepted

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

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

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,input().split())
lst1 = [1,3,5,7,8,10,12]
lst2 = [4,6,9,11]
lst3 = [2]

if (x in lst1 and y in lst1) or (x in lst2 and y in lst2) or (x in lst3 and y in lst3):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
isOk=False
listA = [1,3,5,7,8,10,12]
listB = [4,6,9,11]
if x==y:
    isOk=True
elif x in listA and y in listA:
    isOk=True
elif x in listB and y in listB:
    isOk=True
print(["No","Yes"][isOk])

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

Submission status: Accepted

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

if a[0] in b and a[1] in b:
  e += 1
elif a[0] in c and a[1] in c:
  e += 1

if e == 1:
  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 (g1.count(x) == 1 and g1.count(y) == 1) or (
        g2.count(x) == 1 and g2.count(y) == 1) or (g3.count(x) == 1
                                                   and g3.count(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:
    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')

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
result = 0
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")

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 = {int(s) for s in input().split()}
print('Yes' if 2 not in N and len({4,6,9,11} & N) != 1 else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(x: int, y: int):
    g = [4, 6, 9, 11]
    ret = YES
    if x == 2 or y == 2:
        ret = NO
    elif x in g and not y in g or y in g and not x in g:
        ret = NO
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(x, y)

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]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

x, y = nl()

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:
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:
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:
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())
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
if x == 2 or y == 2:
    print('No')
elif (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())

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

if x in a and y in a:
    z = "Yes"
if x in b and y in b:
    z = "Yes"
if x == 2 and y == 2:
    z = "Yes"
print(z)

Submission status: Accepted

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

# print(a)
# print(b)
# print(c)

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

# print(a.index(x))
# print(b.index(x))
# print(c.index(x))

# print(a.index(y))
# print(b.index(y))
# print(c.index(y))

# print(x in a)
# print(x in b)
# print(x in c)

# print(b in a)
# print(b in b)
# print(b in c)

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
li = [4,6,9,11]
if x == 2 or y == 2:
  print("No")
elif x in li and y in li:
  print("Yes")
elif not x in li and not y in li:
  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) or (x in g2 and y in g2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if a==2:
 A=2
elif a==4 or a==6 or a==9 or a==11:
 A=1
else:
 A=3
if b==2:
 B=2
elif b==4 or b==6 or b==9 or b==11:
 B=1
else:
 B=3
if A==B:
 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 g in group:
  if x in g and y in g:
    print("Yes")
    exit(0)
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 or x in g2 and y in g2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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


abc()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# class Node:
#     def __init__(self, data): #コンストラクタ
#         self.data = data #ノードがもつ数値
#         self.left = None #左エッジ
#         self.right = None #右エッジ
#
# class BST:
#     def __init__(self, number_list): #コンストラクタ
#         self.root = None #ルート初期化
#         for node in number_list: #数値を持つ配列から二分木を生成
#             self.insert(node) #挿入メソッドを使ってノードを挿入する
#
#     #挿入
#     def insert(self, data):
#         n = self.root #nにルートを代入
#         if n == None: #ルートに何も入っていない場合
#             self.root = Node(data) #ルートにノードを代入(二分探索木の一番上の部分が出来る)
#             return #呼び出し部分に戻る
#         else: #ルートノードに既に数値が入ってる場合
#             while True: #return等が入るまでずっと実行
#                 entry = n.data #entryにnが持つデータ(数値)を入れる
#                 if data < entry: #entryとdata(代入するデータ)を比較してentryの方が大きい場合
#                     if n.left is None: #nの左エッジに何も入っていない場合
#                         n.left = Node(data) #nの左エッジにdata(代入するデータ)を代入
#                         return ##呼び出し部分に戻る
#                     n = n.left #nの左に何か入っている場合nにnのleftを代入
#                 elif data > entry: #entryとdata(代入するデータ)を比較してentryの方が小さい場合
#                     if n.right is None: #nの右エッジに何も入っていない場合
#                         n.right = Node(data) #nの右エッジにdata(代入するデータ)を代入
#                         return #呼び出し部分に戻る
#                     n = n.right #nの右エッジに何か入っている場合nにnのrightを代入
#                 else: #上2つの条件分岐以外の場合
#                     n.data = data #nのdataにdata(代入するデータ)を代入
#                     return #呼び出し部分に戻る

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
key = [a, b, c]
yes = 0
x, y = map(int, input().split())
for i in key:
    if x in i and y in i:
        print("Yes")
        yes = 1
        break

if not yes:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
grp = [0]*13
grp[2] = 1
for i in [4,6,9,11]:
  grp[i] = 2
print('Yes' if grp[x] == grp[y] else 'No')

Submission status: Accepted

Solution code:
ans = ["A", "C", "A", "B", "A", "B", "A", "A", "B", "A", "B", "A"]
x, y = map(int, input().split())
if ans[x - 1] == ans[y - 1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

x,y = IL()
ga = [1,3,5,7,8,10,12]
gb = [4,6,9,11]

if (x in ga and y in ga) or (x in gb and y in gb):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = [int(i) - 1 for i in input().split()]

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

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

def both_in(X):
    return x in X and y in X

if both_in(A) or both_in(B) or both_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]
x, y = map(int,input().split())
for i in a:
  if x == i:
    x = "a"
  if y == i:
    y = "a"
for i in b:
  if x == i:
    x = "b"
  if y == i:
    y = "b"
if x == y:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

    if x in a and y in a:
        return 'Yes'
    if x in b and y in b:
        return 'Yes'
    if x in c and y in c:
        return 'Yes'
    return 'No'

print(solve())

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

flg = "Yes"

if ls1.count(x) != ls1.count(y):
    flg = 'No'
elif ls2.count(x) != ls2.count(y):
    flg = 'No'
elif ls3.count(x) != ls3.count(y):
    flg = 'No'
else:
    pass

print(flg)

Submission status: Accepted

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

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

    if (x in group_a) and (y in group_a):
        print('Yes')
        return

    elif (x in group_b) and (y in group_b):
        print('Yes')
        return

    elif (x in group_c) and (y in group_c):
        print('Yes')
        return

    print('No')

resolve()

Submission status: Accepted

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

Submission status: Accepted

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