Problem:


Score : 100 points

Problem Statement

Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.
Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.

Constraints

x and y are integers.

1 ≤ x < y ≤ 12

Input

Input is given from Standard Input in the following format:

x y

Output

If x and y belong to the same group, print Yes; otherwise, print No.

Sample Input 1

1 3

Sample Output 1

Yes

Sample Input 2

2 4

Sample Output 2

No



Sample input:
1 3


Sample output:
Yes

Submission status: Accepted

Solution code:
a,b,=map(int,input().split())
def c(a, b):
    if a==2 and b==2:
        return True
    s = {4,6,9,11}
    if a in s and b in s:
        return True
    s = {1,3,5,7,8,10,12}
    if a in s and b in s:
        return True
    return False
print('Yes' if c(a,b) else 'No')

Submission status: Accepted

Solution code:

x, y = map(int, input().split())
listi = [x, y]
list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]

for i in listi:
    list1.append(i)
    list2.append(i)
    list3.append(i)

if len(set(list1)) == len(list1)-2 or len(set(list2)) == len(list2)-2 or len(set(list3)) == len(list3)-2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
nums = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
if nums[x] == nums[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 a.count(x) & a.count(y) or b.count(x) & b.count(y) or c.count(x) & c.count(y):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

if x == 2:
    x = "c"
elif x == 4 or x == 6 or x == 9 or x == 11:
    x = "b"
else:
    x = "a"

if y == 2:
    y = "c"
elif y == 4 or y == 6 or y == 9 or y == 11:
    y = "b"
else:
    y = "a"

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
 
if x == 2 or y == 2:
  print("No")
  exit()
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:
group = [ 0 for i in range(13) ]
group[2] = 1
for i in [4,6,9,11]:
    group[i]=2


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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
x,y = LI()
f = [0,1,2,1,3,1,3,1,1,3,1,3,1]
if f[x] == f[y]:
    print("Yes")
else:
    print("No")
#B

#C
"""
h,w = LI()
ans = float("inf")
x = w//2
y = h//2
if not w%2:
    for i in range(1,h):
        if (h-i)%2 == 0:
            ans = min(ans,abs(w*i-w*(h-i)//2))
        ans = min(ans,abs(w*i-x*(h-i)))
else:
    for i in range(1,h):
        if (h-i)%2 == 0:
            ans = min(ans,abs(w*i-w*(h-i)//2))
        if w*i < x*(h-i):
            ans = min(ans,abs(w*i-(x+1)*(h-i)))
        elif w*i < (x+1)*(h-i):
            ans = min(ans,h-i)
        else:
            ans = min(ans,abs(w*i-x*(h-i)))
if not h%2:
    for i in range(1,w):
        if (w-i)%2 == 0:
            ans = min(ans,abs(h*i-h*(w-i)//2))
        ans = min(ans,abs(h*i-y*(w-i)))
else:
    for i in range(1,w):
        if (w-i)%2 == 0:
            ans = min(ans,abs(h*i-h*(w-i)//2))
        if h*i < y*(w-i):
            ans = min(ans,abs(h*i-(y+1)*(w-i)))
        elif h*i < (y+1)*(w-i):
            ans = min(ans,w-i)
        else:
            ans = min(ans,abs(h*i-y*(w-i)))
print(ans)
"""

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

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:
g='XACABABAABABA'
x,y=map(int,input().split())
print(["No","Yes"][g[x]==g[y]])

Submission status: Accepted

Solution code:
def grouping(x: int, y: int)->bool:
    group = [
        [1, 3, 5, 7, 8, 10, 12],
        [4, 6, 9, 11],
        [2],
    ]
    for g in group:
        if x in g and y in g:
            return True
        elif x in g:
            return False
        elif y in g:
            return False
    return False


if __name__ == "__main__":
    x, y = map(int, input().split())
    yes = grouping(x, y)
    print('Yes' if yes else 'No')

Submission status: Accepted

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

_dict={1:1,
       2:3,
       3:1,
       4:2,
       5:1,
       6:2,
       7:1,
       8:1,
       9:2,
       10:1,
       11:2,
       12:1,}

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
d=[0,1,2,1,0,1,0,1,1,0,1,0,1]
a,b=map(int,input().split())
print('Yes' if d[a]==d[b] 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())
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:
d = {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 = map(int, input().split())
print('YNeos'[d[x] != d[y]::2])

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
def check(a):
    if (a == 4 or a == 6 or a == 9 or a == 11):
        check_a = "A"
    elif a == 2:
        check_a = "B"
    else:
        check_a = "C"
    return check_a
  
if check(X) == check(Y):
    print('Yes')
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = [int(x) for x in input().split()]
li = [0,2,0,1,0,1,0,0,1,0,1,0]
if(li[x-1] == li[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")
elif x in c and y in c:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

if x in list1 and y in list1:
	print('Yes')
elif x in list2 and y in list2:
	print('Yes')
elif x in list3 and y in list3:
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:

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

if x in list1:
	print('Yes' if y in list1 else 'No')
if x in list2:
	print('Yes' if y in list2 else 'No')
if x in list3:
	print('Yes' if y in list3 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())

ans = 'No'
if x in A and y in A:
    ans = 'Yes'
if x in B and y in B:
    ans = 'Yes'
if x in C and y in C:
    ans = 'Yes'

print(ans)

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())
if(x in group_A):
    if(y in group_A):
        print("Yes")
    else:
        print("No")
elif(x in group_B):
    if(y in group_B):
        print("Yes")
    else:
        print("No")
else:
    if(y in group_C):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
x, y = map(int, input().split())
data = ['', 'a', 'c', 'a', 'b', 'a', 'b', 'a', 'a', 'b', 'a', 'b', 'a']
print('Yes' if data[x] == data[y] else '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 "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

elif((x==4 or x==6 or x==9 or x==11) or (y==4 or y==6 or y==9 or y==11)):
        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")
        else:
            print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def func(a, b):
    g1 = [1, 3, 5, 7, 8, 10, 12]
    g2 = [4, 6, 9, 11]
    result = 'Yes' if (A in g1 and B in g1) or (A in g2 and B in g2) else 'No'
    return result

A, B = map(int, input().split())

print(func(A, B))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=[0,1,2,1,3,1,3,1,1,3,1,3,1]
x,y=(int(x) for x in 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]
if x in g1 and y in g1:
    print('Yes')
elif x in g2 and y in g2:
    print('Yes')
elif x in g3 and y in g3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

res = 'No'
for g in groups:
    if x in g and y in g:
        res = 'Yes'

print(res)

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) 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:
a,b = map(int, input().split())
c = 0
d = 0
e = [1,3,5,7,8,10,12]
f = [4,6,9,11]
g = [2]
for i in e:
  if i==a:
    c = "x"
  if i==b:
    d = "x"
for j in f:
  if j==a:
    c = "y"
  if j==b:
    d = "y"
if c==d or a==b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if (x in A):
    xg = 0
elif (x in B):
    xg = 1
else:
    xg = 2
if (y in A):
    yg = 0
elif (y in B):
    yg = 1
else:
    yg = 2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]
A = x in list1 and y in list1
B = x in list2 and y in list2
C = x in list3 and y in list3
if A == True or B == True or C == True:
  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) 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:
from sys import stdin
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
a, b = [int(x) for x in stdin.readline().rstrip().split()]
if a == b:
  print('Yes')
elif a in g1 and b in g1:
  print('Yes')
elif a in g2 and b in g2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
a=[1,3,1,2,1,2,1,1,2,1,2,1]
print("Yes") if a[x-1]==a[y-1] 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:
# ABC 062 A - Grouping
x,y =map(int,input().split())
ga = [1,3,5,7,8,10,12]
gb = [4,6,9,11]
gc= [2]
if x in ga and y in ga:
    print("Yes")
elif x in gb and y in gb:
    print("Yes")
elif x in gc and y in gc:
    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:
import sys
x,y=map(int,input().split())
a =[(1,3,5,7,8,10,12),(4,6,9,11),(2,)]
for i in a:
	if x in i and y in i:
		print('Yes')
		sys.exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'No'
for a in A:
    if x in a and y in a:
        ans = 'Yes'
        
print(ans)

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if((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:
x, y = [ int(x) for x in input().split() ]

def group(x):
    g = {
        0: set([1, 3, 5, 7, 8, 10, 12]),
        1: set([4, 6, 9, 11]),
        2: set([2])
    }
    for k in g.keys():
        if x in g[k]:
            return k
    return len(g)
ans = group(x) == group(y)

print("Yes" if ans else "No")
print()

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

list1 = {1,3,5,7,8,10,12}
list2 = {4,6,9,11}
list3 = {2}
result = "No"

set_list = [list1,list2,list3]
for data in set_list:
    if x in data:
        if y in data:
            result = "Yes"

print(result)

Submission status: Accepted

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

if ({x, y} & {4, 6, 9, 11} == {x, y}) or ({x, y} & {1, 3, 5, 7, 8, 10, 12} == {x, y}):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x,y=map(int,raw_input().split())
G="_020101001010"
print["No","Yes"][G[x]==G[y]]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if (xy[0]in B and xy[1] in B) or (xy[0]in C and xy[1] in C):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
groups = [[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 groups[i]: x = i
    if y in groups[i]: y = i

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fileinput


GROUPS = list(enumerate([{1,3,5,7,8,10,12}, {4,6,9,11}, {2}]))


def group(n):
    for i, g in GROUPS:
        if n in g:
            return i
    return -1


def algorithm(input_lines):
    x, y = [int(n) for n in input_lines[0]]
    return "Yes" if group(x) == group(y) else "No"


def run():
    out = algorithm([l.strip().split(" ") for l in fileinput.input()])
    print(out)


run()

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
a, b = map(int, input().split())

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

ans = str()

if a in x and b in x:
    ans = 'Yes'
elif a in y and b in y:
    ans = 'Yes'
elif a == z and b == z:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)



if __name__ == '__main__':
    pass

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,12)
c=(2)
if x in a and y in a:
  print('Yes')
elif x in b and y in b:
  print('Yes')
elif x == c and y == c:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

flag = False

if x in a and y in a:
    flag = True
if x in b and y in b:
    flag = True
if x in c and y in c:
    flag = True

if flag:
    print 'Yes'
else:
    print 'No'

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if(a==4 or a==6 or a==9 or a==11):
  aa=2
elif(a==2):
  aa=3
else:
  aa=1
  
if(b==4 or b==6 or b==9 or b==11):
  bb=2
elif(b==2):
  bb=3
else:
  bb=1

if(aa==bb):
  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:
    ans = "Yes"
else:
    ans = "No"
print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
c = 0 
d = 0
if a == 2:
    c = 1
elif a == 4 or a == 6 or a == 9 or a == 11:
    c = 2
else:
    c = 3
if b == 2:
    d = 1
elif b == 4 or b == 6 or b == 9 or b == 11:
    d = 2
else:
    d = 3
if c == d:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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]
d=[a,b,c]
for i in d:
    if x in i and y in i:
        print('Yes')
        exit()
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())

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

Submission status: Accepted

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

print('Yes' if any(x in g and y in g for g in G) else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

print('Yes' if any(x in g and y in g for g in G) else 'No')