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=[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:
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = map(int, input().split())
if x==2:
  print('No')
elif x==4 or x==6 or x==9 or x==11:
  if y==6 or y==9 or y==11:
    print('Yes')
  else: print('No')
else:
  if 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())

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:
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())
s = "xacababaababa"
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) 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 = set([1, 3, 5, 7, 8, 10, 12])
b = set([4, 6, 9, 11])
c = set([2])
g = [a, b, c]
is_same_group = False
for gg in g:
    if x in gg and y in gg:
        is_same_group = True
        break
if is_same_group:
    print('Yes')
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    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:
        return "Yes"
    if x in g2 and y in g2:
        return "Yes"
    if x in g3 and y in g3:
        return "Yes"
    return "No"

if __name__ == '__main__':
    print(main())

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,y}<=a or {x,y}<=b else "No")

Submission status: Accepted

Solution code:
s = set(map(int, input().split()))
b, c = {4, 6, 9, 11}, {2}
a = {i for i in range(1, 13)}-b-c
print('Yes' if any(x & s == s for x in (a, b, c)) else 'No')

Submission status: Accepted

Solution code:
abcList = [[4, 6, 9, 11], [2]]
x, y = map(int, input().split())
a = (abcList[0].count(x) == abcList[0].count(y))
b = (abcList[1].count(x) == abcList[1].count(y))
print("Yes" if (a and b) else "No")

Submission status: Accepted

Solution code:
x,y = map(int, input().strip().split(' '))
def group(n):
  if n in {1,3,5,7,8,10,12}:
    return 0
  elif n in {4,6,9,11}:
    return 1
  elif n in {2}:
    return 2
print('Yes' if group(x) == group(y) else 'No')

Submission status: Accepted

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

x, y = map(int, input().split())
if (x in g1) and (y in g1):
  print("Yes")
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:
a=[0,1,3,1,2,1,2,1,1,2,1,2,1];x,y=map(int,input().split());print("Yes") if a[x]==a[y] else print("No")

Submission status: Accepted

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

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

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 = input().split()
a = {'1','3','5','7','8','10','12'}
b = {'4','6','9','11'}
print("Yes" if {x,y} <= a or {x,y} <= b else "No")

Submission status: Accepted

Solution code:

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    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
    if x in group_b and y in group_b:
        print('Yes')
        return
    if x in group_c and y in group_c:
        print('Yes')
        return
    print('No')


if __name__ == '__main__':
    main()

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:
	if y in Group1:
		print("Yes")
	else:
		print("No")
elif x in Group2:
	if y in Group2:
		print("Yes")
	else:
		print("No")
elif x in Group3:
	if y in Group3:
		print("Yes")
	else:
		print("No")
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())

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());l=[4,6,9,11];print('YNeos'[(x in l)^(y in l)|(2 in (x,y))::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
group = '0020101001010'
x, y = map(int, input().split())
print('Yes' if group[x] == group[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,b = [int(i) for i in input().split()]

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

if 2 in (a,b):
  print('No')
elif a in l1 and b in l2:
  print('No')
elif a in l2 and b in l1:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
g = (0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0)
print("Yes" if g[x] is g[y] else "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())
xy = {x,y}
ans = "No"
for i in l:
    if len(xy&i)==2:
        ans = "Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n="0123456789abc"
g="xacababaababa"
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())
g1 = [2]
g2 = [4, 6, 9, 11]
g3 = [1, 3, 5, 7, 8, 10, 12]
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())
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]
f = False

if x in g1 and y in g1:
  f = True
if x in g2 and y in g2:
  f = True

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

Submission status: Accepted

Solution code:
g1 = ["1", "3", "5", "7", "8", "10", "12"]
g2 = ["4", "6", "9", "11"]
x, y = input().split()
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:
    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:
xy = {int(i) for i in input().split()}
A = {1,3,5,7,8,10,12}
B = {4,6,9,11}
C = {2}
print("Yes" if xy < A or xy < B or xy < C else "No")

Submission status: Accepted

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

Submission status: Accepted

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

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

if a in g1 and b in g1:
  print('Yes')
elif a in g2 and b in g2:
  print('Yes')
elif a in g3 and b in g3:
  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 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())
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:
g = [[1,3,5,7,8,10,12],
     [4,6,9,11],
     [2]]
a, b = map(int, input().split())
for i in g:
  if a in i and b in i:
    print("Yes")
    exit()
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==y or (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())
if x in { 1, 3, 5, 7, 8, 10, 12 } and y in { 1, 3, 5, 7, 8, 10, 12 }:
  print("Yes")
elif x in { 4, 6, 9, 11 } and y in { 4, 6, 9, 11 }:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s='0131212112121'
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())
s1 = [1, 3, 5, 7, 8, 10, 12]
s2 = [4, 6, 9, 11]
print("Yes" if (x in s1 and y in s1) or (x in s2 and y in s2) else "No")

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
group = [-1,0,1,0,2,0,2,0,0,2,0,2,0]
print('Yes' if group[x]==group[y] else '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]
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:
a1 = [1,3,5,7,8,10,12]
a2 = [4,6,9,11]
a3 = [2]
x,y=map(int, input().split())
if x in a1 and y in a1:
    print('Yes')
elif x in a2 and y in a2:
    print('Yes')
elif x in a3 and y in a3:
    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]
print('Yes' if x==y==2 or (x in X and y in X) or (x in Y and y in Y)  else 'No')

Submission status: Accepted

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


if __name__ == "__main__":
    test()

Submission status: Accepted

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

Submission status: Accepted

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

def get_group(num):
  for (i, g) in enumerate(GROUPS):
    if num in g:
      return i
  return -1

(x, y) = (int(tok) for tok in input().split())
print("Yes" if get_group(x) == get_group(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]
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}
print('Yes' if {x,y}<=a or {x,y}<=b 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())
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:
def main():
    x,y = map(int,input().split())
    if(( x==4  and y==6 ) or ( x==4 and y==9 ) or ( x==4 and y==11 ) or ( x==6 and y==9 ) or ( x==6 and y==11 ) or ( x==9 and y==11 )):
        print("Yes")
    elif(( x==1 and (y==3 or y==5 or y==7 or y==8 or y==10 or y==12)) or ( x==3 and (y==5 or y==7 or y==8 or y==10 or y==12)) or ( x==5 and (y==7 or y==8 or y==10 or y==12 )) or ( x==7 and (y==12 or y==8 or y==10 )) or ( x==8 and (y==10 or y==12) ) or ( x==10 and y==12 )):
        print("Yes")
    else:
        print("No")
    
main()

Submission status: Accepted

Solution code:
# A-Grouping(ABC062)
A=[[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y=map(int,input().split())
for i in range(2):
    if x in A[i]  and y in A[i]:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
 
X, Y=map(int,input().split())
 
if X==2 or Y==2:
  print('No')
  sys.exit()
elif X==4 or X==6 or X==9 or X==11:
  if Y==6 or Y==9 or Y==11:
    print('Yes')
    sys.exit()
  else:
    print('No')
    sys.exit()
else:
  if Y==3 or Y==5 or Y==7 or Y==8 or Y==10 or Y==12:
    print('Yes')
    sys.exit()
  else:
    print('No')
    sys.exit()

Submission status: Accepted

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

Submission status: Accepted

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

arr = [1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 ]

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

groupa = [1,3,5,7,8,10,12]
groupb = [4,6,9,11]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = 'ACABABAABABA'
x,y = map(int, input().split())
print('Yes' if S[x-1]==S[y-1] else '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) or (x in c and y in c) else ('No'))

Submission status: Accepted

Solution code:
S="_ACABABAABABA"
a,b=map(int,input().split())
print("Yes" if S[a]==S[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, )
 
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:
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]

x,y = map(int,input().split())
if group[x] == group[y]:
  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==4 or x==6 or x==9 or x==11:
    if y==4 or y==6 or y==9 or y==11:
        print('Yes')
    else:
        print('No')
else:
    if y == 4 or y == 6 or y == 9 or y == 11:
        print('No')
    else:
        print('Yes')

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]

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

Submission status: Accepted

Solution code:
x , y = input().split()
a1 = [1 , 3 , 5 , 7 , 8 , 10 , 12]
b1 = [4 , 6 , 9 , 11]
c1 = [2]
x = int(x)
y = int(y)
b = False
if x in a1:
    if y in a1:
        b = True
if x in b1:
    if y in b1:
        b = True
if x in c1:
    if y in c1:
        b = True

if 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 = [2]
c = [4, 6, 9, 11]

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 python3
import sys
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(x: int, y: int):
    table = [0]*13
    table[2] = 2
    table[4] = 1
    table[6] = 1
    table[9] = 1
    table[11] = 1
    if table[x] == table[y]:
        yes()
    else:
        no()
    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:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    x,y = inputMap()
    
    UF = UnionFind(13)
    
    UF.union(1,3)
    UF.union(1,5)
    UF.union(1,7)
    UF.union(1,8)
    UF.union(1,10)
    UF.union(1,12)
    
    UF.union(4,6)
    UF.union(4,9)
    UF.union(4,11)
    
    tmp = UF.is_same(x,y)
    if tmp == True:
        print("Yes")
    else:
        print("No")
    
    
class UnionFind(object):
	def __init__(self, n=1):
		self.par = [i for i in range(n)]
		self.rank = [0 for _ in range(n)]
		self.size = [1 for _ in range(n)]
		
	# x が属するグループを探索
	def find(self, x):
		if self.par[x] == x:
			return x
		else:
			self.par[x] = self.find(self.par[x])
			return self.par[x]
		
	# x と y のグループを結合
	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x != y:
			# メンバ数の更新
			sum = self.size[x] + self.size[y]
			self.size[x] = sum
			self.size[y] = sum
			# 短いリストを長いリストのルートに繋ぎ直す
			if self.rank[x] < self.rank[y]:
				x, y = y, x
			if self.rank[x] == self.rank[y]:
				self.rank[x] += 1
			self.par[y] = x
	
	# x と y が同じグループがどうか
	def is_same(self, x, y):
		return self.find(x) == self.find(y)
		
	# x が属するグループのメンバ数を返却
	def getSize(self, x):
		par_x = self.find(x)
		return self.size[par_x]
	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
a,b = map(int,input().split())
for i in range(3):
  if a in l[i]:
    A = i
  if b in l[i]:
    B = i
if A == 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 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())
if x == 1 or x == 3 or  x == 5 or  x == 7 or  x == 8 or  x == 10 or  x == 12:
  x = 1
elif x == 2:
  x = 2
else:
  x = 4
if y == 1 or y == 3 or  y== 5 or  y== 7 or  y== 8 or  y== 10 or  y == 12:
  y = 1
elif y == 2:
  y = 2
else:
  y = 4
  
if x == y:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x, y = input().rstrip().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]
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]
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:
conds = [
    [1,3,5,7,8,10,12],
    [4,6,9,11],
    [2]
]

x,y = [int(i) for i in input().split()]
res = True
for cond in conds:
    if (x in cond)!=(y in cond):
        res=False
print("Yes" if res else "No")

Submission status: Accepted

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

Submission status: Accepted

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

def get_group(x):
    if x in a:
        return 'a'
    if x in b:
        return 'b'
    if x in c:
        return 'c'

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
group = {1:1, 3:1, 5:1, 7:1, 8:1, 10:1, 12:1, 4:2, 6:2, 9:2, 11:2, 2:3}
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]
c = [2]
d, e = map(int, input().split())
if (d in a and e in a) or (d in b and e in b) or (d in c and e in c):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x,y=[int(x) for x in 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')
    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:
a = [-1,0,1,0,2,0,2,0,0,2,0,2,0]
x,y  = 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())

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

print('Yes' if x in g1 and y in g1 or x in g2 and y in g2 else '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:
s = set(map(int,input().split()))

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

if len(a & s)==2 or len(b & s)==2 or len(c & s)==2:
  print("Yes")
else:
  print("No")