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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
g = [set([1, 3, 5, 7, 8, 10, 12]), set([4, 6, 9, 11]), set([2])]
for s in g:
    if x in s and y in s:
        print('Yes')
        break
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())
ans = False
for i in range(len(L)):
  if x in L[i] and y in L[i]:
    ans = True
if ans:
  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]
ans = 'No'
if (x in A) and (y in A):
  ans ='Yes'
elif (x in B) and (y in B):
  ans ='Yes'
elif (x in C) and (y in C):
  ans ='Yes'
  
print(ans)

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]
a = 0
if x in A and y in A:
    a = 1
else:
    if x in B and y in B:
        a = 1
    else:
        if x in C and y in C:
            a = 1

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

Submission status: Accepted

Solution code:
x1, x2 = map(int, input().split())
 
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
 
if (x1 in l1) & (x2 in l1):
  print("Yes")
elif (x1 in l2) & (x2 in l2):
  print("Yes")
elif (x1 in l3) & (x2 in l3):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
from sys import exit
x,y=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')
    exit(0)
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())
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:
group = [0] * 13
for i in [1, 3, 5, 7, 8, 10, 12]:
	group[i] = 1
for i in [4, 6, 9, 11]:
	group[i] = 2
group[2] = 3
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]
chk = [0]*13
for a in A:
  chk[a] = 1
for a in B:
  chk[a] = 2
for a in C:
  chk[a] = 3
if chk[x]==chk[y]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
m = dict()
a0 = [1,3,5,7,8,10,12]
a1 = [4,6,9,11]
a2 = [2]

for i,j in enumerate([a0,a1,a2]):
    for k in j:
        m[k] = i

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

if m[a] == m[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: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())
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")
elif x in group_b and y in group_b:
  print("Yes")
elif x in group_c and y in group_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)
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:
print('YNeos'['2'in input()::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
li = [[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 li[i]:
        a = i
for i in range(3):
    if y in li[i]:
        b = i
if a == b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
li = [[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 li[i]:
        a = i
for i in range(3):
    if y in li[i]:
        b = i
if a == b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
l1=[1,3,5,7,8,10,12]
l2=[4,6,9,11]
l3=[2]
l=list(map(int,input().split()))
r1=[x for x in l if x in l1]
r2=[x for x in l if x in l2]
r3=[x for x in l if x in l3]
print("Yes" if max(len(r1),len(r2),len(r3))==2 else "No")

Submission status: Accepted

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

def hantei(x):
  if x in a:
    return 1
  elif x in b:
    return 2
  else:
    return 3

x,y=map(int,input().split())
print("Yes" if hantei(x)==hantei(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]
l = [a,b,c]
answer = "No"
for i in l:
  if x in i and y in i:
    answer = "Yes"
print(answer)

Submission status: Accepted

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

if x in [1, 3, 5, 7, 8, 10, 12]:
    x_j = 1

elif x in [2]:
    x_j = 2

elif x in [4, 6, 9, 11]:
    x_j = 3

if y in [1, 3, 5, 7, 8, 10, 12]:
    y_j = 1

elif y in [2]:
    y_j = 2

elif y in [4, 6, 9, 11]:
    y_j = 3

if (x_j == y_j):
    print("Yes")

else:
    print("No")

Submission status: Accepted

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

if x <= 0 or x >= 13 or y <= 0 or y >= 13:
    sys.exit()
if x >= y:
    sys.exit()

A = (1, 3, 5, 7, 8, 10, 12)
B = (4, 6, 9, 11)

if x == 2 or y == 2:
    print("No")
    sys.exit()
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:
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

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

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

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

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

g= {1:'g1', 2:'g3', 3:'g1', 4:'g2', 5:'g1', 6:'g2', 7:'g1', 8:'g1', 9:'g2', 10:'g1', 11:'g2', 12:'g1'}

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

Submission status: Accepted

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


def main():
    A = {1, 3, 5, 7, 8, 10, 12}
    B = {4, 6, 9, 11}
    C = {2}
    xy = set(map(int, input().split()))
    if xy <= A or xy <= B or xy <= C:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def actual(x, y):
    group1 = {1, 3, 5, 7, 8, 10, 12}
    group2 = {4, 6, 9, 11}
    group3 = {2}

    for group in [group1, group2, group3]:
        if x in group and y in group:
            return 'Yes'

    return 'No'

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

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

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())
ans = 'No'

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):
    ans = 'Yes'

print(ans)

Submission status: Accepted

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

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

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:
print(["Yes","No"][input().count("2")])

Submission status: Accepted

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

x , y = map(int, input().split())
for s in sequence:
    if x in s and y in s:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
print(' YNeos'[len(set([2 if i==2 else 1 if i in [4,6,9,11] else 0 for i in list(map(int,input().split()))]))::2])

Submission status: Accepted

Solution code:
print(' YNeos'[len(set([2 if i==2 else 1 if i in[4,6,9,11] else 0 for i in list(map(int,input().split()))]))::2])

Submission status: Accepted

Solution code:
print(' YNeos'[len(set([2 if i in [2] else 1 if i in [4,6,9,11] else 0 for i in list(map(int,input().split()))]))::2])

Submission status: Accepted

Solution code:
x,y=map(int,input().split());print(' YNeos'[len(set([2 if i in [2] else 1 if i in [4,6,9,11] else 0 for i in [x,y]]))::2])

Submission status: Accepted

Solution code:
groups = [{1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}]
x, y = map(int, input().split())
flag = False
for group in groups:
    if x in group and y in group:
        flag = True
print('Yes' if flag 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:
    x = "A"
elif x in B:
    x = "B"
else:
    x = "C"

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

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
l=[0,
   1,
   3,
   1,
   2,
   1,
   2,
   1,
   1,
   2,
   1,
   2,
   1]

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

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:
  print("Yes")
else:
  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:
x,y = map(int,input().split())
# al = list(map(int,input().split()))

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

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

Submission status: Accepted

Solution code:
#!python3

LI = lambda: list(map(int, input().split()))

# input
x, y = LI()


def group(num):
    if num == 2:
        return 0
    if num in {4, 6, 9, 11}:
        return 1
    return 2


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


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

dic = {'A': [1, 3, 5, 7, 8, 10, 12], 'B': [4, 6, 9, 11], 'C': [2]}

gx = 0
gy = 0
for key, value in dic.items():
    if x in value:
        gx = key
    if y in value:
        gy = key
ans = 'Yes' if gx == gy else 'No'
print(ans)

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:
g1 = [4,6,9,11]
g2 = [2]
g3 = [1,3,5,7,8,10,12]

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

if x in g1 and y in g1:
    print("Yes")
    exit()

if x == y == 2:
    print("Yes")
    exit()

if x in g3 and y in g3:
    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 == 2 or y == 2:
  print("No")
elif x in A and y in A:
  print("Yes")
elif x in B and y in B:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
x,y=map(int,input().split())
print('NYoe s'[(x in a and y in a) or (y in b and y in b)::2] if x!=2 and y!=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:
  group_x=0
elif x in b:
  group_x=1
else:
  group_x=2

if y in a:
  group_y=0
elif y in b:
  group_y=1
else:
  group_y=2

if group_x==group_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')
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 == 2):
    print('Yes')
    exit()
print('No')

Submission status: Accepted

Solution code:
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
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:
nums = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] 
x, y = map(int, input().split())
if nums[x - 1] == nums[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")
    exit()
elif x in B and y in B:
    print("Yes")
    exit()
elif x in C and y in C:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

x, y = map(int, input().split())
if (x in list_a and y in list_a) or (x in list_b and y in list_b) or (x in list_c and y in list_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())
ok = False
if x == 4 or x == 6 or x == 9 or x == 11:
    if y == 4 or y == 6 or y == 9 or y == 11: ok = True
elif 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: ok = True
if ok: 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==2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

    ans = str()
    if x in g1 and y in g1:
        ans = "Yes"
    elif x in g2 and y in g2:
        ans = "Yes"
    elif x == g3 and y == g3:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)
resolve()

Submission status: Accepted

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

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

if x in a1:
  _x = 0
elif x in a2:
  _x = 1
else:
  _x = 2
  
if y in a1:
  _y = 0
elif y in a2:
  _y = 1
else:
  _y = 2
  
if _x == _y:
  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]
result = 'No'
x, y = map(int, input().split())

if x in g1:
    if y in g1:
        result = 'Yes'
elif x in g2:
    if y in g2:
        result ='Yes'
print(result)

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

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

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:
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]

x_group=''
y_group=''

for i in range(len(a)):
  if x==a[i]:
    x_group='a'
  if y==a[i]:
    y_group='a'
    
for i in range(len(b)):
  if x==b[i]:
    x_group='b'
  if y==b[i]:
    y_group='b'

for i in range(len(c)):
  if x==c[i]:
    x_group='c'
  if y==c[i]:
    y_group='c'
    
if x_group==y_group:
  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())
d = {1:"a", 2:"c", 3:"a", 4:"b", 5:"a", 6:"b", 7:"a", 8:"a", 9:"b", 10:"a", 11:"b", 12:"a"}

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

Submission status: Accepted

Solution code:
x,y=input().split()
l=['1','3','5','7','8','10','12','4','6','9','11','2']
x_loc=l.index(x)
y_loc=l.index(y)

if x_loc==11 and y_loc==11:
    print('Yes')
elif x_loc<7 and y_loc<7:
    print('Yes')
elif x_loc>6 and x_loc<11 and y_loc>6 and y_loc<11:
    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:
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 = 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 == '2' and y == '2':
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
gp_a = [1,3,5,7,8,10,12]
gp_b = [4,6,9,11]

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

if x == 2 or y == 2:
  print("No")
  sys.exit()
if (x in gp_a) and (y in gp_a):
  print("Yes")
elif (x in gp_b) and (y in gp_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:
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())

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())
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:
def resolve():
    x, y = map(int, input().split())
    list = [1, 3, 5, 7, 8, 10, 12]
    lists = [4, 6, 9, 11]
    print("Yes" if (list.count(x) == 1 and list.count(y)) or (lists.count(x) == 1 and lists.count(y)) else "No")
resolve()

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
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}
if d[a] == d[b]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    x, y = mi()
    s = [4, 6, 9, 11]
    if x == 2 or y == 2:
        print('No')
    else:
        if (x in s and y in s) or (x not in s and y not in s):
            print('Yes')
        else:
            print('No')



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for i in c:
  if x==i:
    x='c'
  if y==i:
    y='c'

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

Submission status: Accepted

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