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:
# -*- coding: utf-8 -*-S
x,y = [int(i) for i in input().split()]

"""
if x == 2 or y == 2:
    print("No")
elif x == 4 or x == 6 or x == 9 and 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　and y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
    print("Yes")
else:
    print("No")
"""

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

for i in range(7):
    if A[i] == x:
        for j in range(i,7):
            if A[j] == y:
                tmp = True
for i in range(4):
    if B[i] == x:
        for j in range(i,4):
            if B[j] == y:
                tmp = True
if tmp:
    print("Yes")
if not tmp:
    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 = [int(_) for _ in input().split()]
c1 = [1,3,5,7,8,10,12]
c2 = [4,6,9,11]
c3 = [2]
cnt = 0
for t in [c1, c2, c3]:
    if (x in t) and (y in t):
        cnt = 1
if cnt == 1:
    print("Yes")
else:       
    print("No")

Submission status: Accepted

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

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

    for i in range(len(g)):
        if g[i].count(x) == 1 and g[i].count(y) == 1:
            print('Yes')
            return
    print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if (x in lst0 and y in lst0) or (x in lst1 and y in lst1):
    print('Yes')

else:
    print('No')

Submission status: Accepted

Solution code:
import sys

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

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

def main():
    return 'Yes' if g[x] == g[y] else 'No'

if __name__ == '__main__':
    ans = main()
    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]
if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

if group[x] == group[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]
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:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
mod = 10**9+7
ans = 0 ;count = 0 ;pro = 1
n=20
class UnionFind:
    __slots__ = ['id','sz']

    def __init__(self, n):
        self.id = [-1] * n
        self.sz = n

    def root(self, x):
        if self.id[x] < 0:
            return x
        else:
            self.id[x] = self.root(self.id[x])
            return self.id[x]

    def find(self, x, y):
        return self.root(x) == self.root(y)

    def union(self, x, y):
        s1, s2 = self.root(x), self.root(y)
        if s1 != s2:
            if self.id[s1] <= self.id[s2]:
                self.id[s1] += self.id[s2]
                self.id[s2] = s1
            else:
                self.id[s2] += self.id[s1]
                self.id[s1] = s2
            self.sz-=1
            return True
        return False

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)
x,y=map(int,input().split())
if uf.find(x,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],[2],[4,6,9,11]]
def check(num):
    g_num=0
    for i in range(1,3):
        if num in g[i]:
            g_num=i
            break
    return g_num
if check(x)==check(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]
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:
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
x, y = map( int, input().split() )
if ( x in l1 and y in l1 ) or ( x in l2 and y in l2 ) or ( x in l3 and y in l3 ) : 
   print( "Yes" )
else :
   print( "No" )

Submission status: Accepted

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

Submission status: Accepted

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

print('Yes') if list1.count(x) != list2.count(y) else print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(3):
    if x in group[i]:
        x = i
        break
for i in range(3):
    if y in group[i]:
        y = i
        break

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

Submission status: Accepted

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

print("Yes" if g[x - 1] == g[y - 1] else "No")

Submission status: Accepted

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

for i in range(3):
    if x in a[i]:
        if y in a[i]:
            print("Yes")
            exit()
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())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if x in c or y in c:
	print ("No")
	exit()
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,b=map(int,input().split())
l_1=[1,3,5,7,8,10,12]
l_2=[4,6,9,11]
l_3=[2]
print(["No","Yes"][a in l_1 and b in l_1 or a in l_2 and b in l_2])

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

B = (4,6,9,11)
C = (1,3,5,7,8,10,12)
if x==y==2:
  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:
  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())
l1=[1,3,5,7,8,10,12]
l2=[4,6,9,11]
l3=[2]
if (x in l1 and y in l1) or (x in l2 and y in l2) or (x in l1 and y in l1) or (x in l3 and y in l3):
    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:
data = input().split(" ")
x = int(data[0])
y = int(data[1])
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
if x in g1 and y in g1:
	print("Yes")
elif x in g2 and y in g2:
	print("Yes")
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())
flg = 0
for lst in [a, b, c]:
    if x in lst and y in lst:
        flg = 1
if flg:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

#solve
def solve():
    x, y = LI()
    a = [1, 3, 5, 7, 8, 10, 12]
    b = [4, 6, 9, 11]
    c = [2]
    if x in a and y in a:
        print("Yes")
        return
    if x in b and y in b:
        print ("Yes")
        return
    if x in c and y in c:
        print ("Yes")
        return
    print("No")
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    x,y = LI()
    f = [0,1,3,1,2,1,2,1,1,2,1,2,1]
    if f[x] == f[y]:
        print("Yes")
    else:
        print("No")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

for g in group:
    if x in g and y in g:
        ans = "Yes"
        break

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}
print("Yes" if {x, y} <= A or {x, y} <= 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) 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:
# ABC062a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


# Union-Find木


class UnionFind:
    def __init__(self, n):
        self.tree = [i for i in range(n)]

    def root(self, x):
        if(self.tree[x] == x):
            return x
        self.tree[x] = self.root(self.tree[x])
        return self.tree[x]  # 経路圧縮

    def same(self, x, y):  # xとyが同じ木に属するか
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if(x == y):
            return
        self.tree[x] = y


uf = UnionFind(12)
uf.unite(0, 2)
uf.unite(0, 4)
uf.unite(0, 6)
uf.unite(0, 7)
uf.unite(0, 9)
uf.unite(0, 11)
uf.unite(3, 5)
uf.unite(3, 8)
uf.unite(3, 10)

x, y = map(int, input().split())
print('YNeos'[not uf.same(x-1, y-1)::2])

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    atog={}
    aa=[[1,3,5,7,8,10,12],[4,6,9,11],[2]]
    for g,ga in enumerate(aa):
        for a in ga:
            atog[a]=g
    x,y=MI()
    if atog[x]==atog[y]:print("Yes")
    else:print("No")

main()

Submission status: Accepted

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

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

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:
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:
    x_flag = 0
elif x in b:
    x_flag = 1
else:
    x_flag = 2

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

if x_flag==y_flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import accumulate

li = [1,3,5,7,8,10,12]
li2 = [4,6,9,11]
li3 = [2]

x,y = [int(x) for x in stdin.readline().rstrip().split()]

if x in li  and y in li:
    print("Yes")
elif x in li2 and y in li2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S="XACABABAABABA"
a,b=map(int,input().split())
if S[a]==S[b]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
a = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = map(int,input().split())
issame = False
for l in a:
  if x in l and y in l:
    issame = True
    break

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

Submission status: Accepted

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

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

if x in a and y in a:
    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())
a = [4,6,9,11]
b = [1,3,5,7,8,10,12]
ans = "No"
if x in a and y in a:
  ans = "Yes"
elif x in b and y in b:
  ans = "Yes"
elif x == y == 2:
  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]
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:
l1=[1,3,5,7,8,10,12]
l2=[4,6,9,11]
l3=[2]

a,b=map(int,input().split())
if a in l1 and b in l1:
  print("Yes")
elif a in l2 and b in l2:
  print("Yes")
elif a in l3 and b in l3:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:

# -*- coding: utf-8 -*-
import math

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

g2 = [4,6,9,11]

#g3
if x == 2 or y == 2 :
  print ("No")
  exit()
  
if x in g2 and y in g2 :
  print ("Yes")
elif x not in g2 and y not in g2 :
  print ("Yes")
else :
  print ("No")

Submission status: Accepted

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

g1 = g2 = -1

for i in range(3):
    if x in l[i]:
        g1 = i
    
    if y in l[i]:
        g2 = i

print('Yes' if g1==g2 else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

ls_1 = [1, 3, 5, 7, 8, 10, 12]
ls_2 = [4, 6, 9, 11]
ls_3 = [2]

if ((x in ls_1) and (y in ls_1)) or ((x in ls_2) and (y in ls_2)) or ((x in ls_3) and (y in ls_3)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

if x in a:
    if y in a:
        print('Yes')
    else:
        print('No')
elif x in b:
    if y in b:
        print('Yes')
    else:
        print('No')
else:
    if 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"}
print("Yes" if {x, y} <= a or {x, y} <= b else "No")

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
s=[1,3,5,7,8,10,12]
d=[4,6,9,11]
if x==y:
  print("Yes")
elif x in s and y in s:
  print("Yes")
elif x in d and y in d:
  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]
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:
#ABC062 A - Grouping
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
x,y = map(int, input().split())
g1 = (1,3,5,7,8,10,12)
g2 = (4,6,9,11)

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

Submission status: Accepted

Solution code:
def f(n):
    if n == 2: return 0
    if n in [4, 6, 9, 11]: return 1
    return 2

a, b = map(int, input().split())
if f(a) == f(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 any(x == i for i in a) and any(y == i for i in a):
       print('Yes')
elif any(x == i for i in b) and any(y == i for i in b):
       print('Yes')
elif any(x == i for i in c) and any(y == i for i in c):
       print('Yes')
else:  print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

l = [1,3,5,7,8,10,12]
k = [4,6,9,11]

#print(l.count(3))

a1 = l.count(x)
a2 = l.count(y)

b1 = k.count(x)
b2 = k.count(y)

if x == 2 or y == 2:
	print('No')
elif a1 == a2:
	print('Yes')
elif b1 == b2:
	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) :
    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:
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]

g = {i:'A' for i in A}
g.update({i:'B' for i in B})
g.update({i:'C' for i in C})

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

Submission status: Accepted

Solution code:
def examA():
    group1 = [1,3,5,7,8,10,12]
    group2 = [4,6,9,11]
    x,y = LI()
    ans = "No"
    if x in group1 and y in group1:
        ans = "Yes"
    elif x in group2 and y in group2:
        ans = "Yes"
    print(ans)

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if (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:
num = list(map(int, input().split(' ')))
mylist = [1, 3, 5, 7, 8, 10, 12]
ans = 0
for i in num:
    if i in mylist:
        ans += 1
    elif i == 2:
        ans += 3

if ans == 0 or ans == 2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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:
#Grouping
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:
    i = 1
elif x in list2:
    i = 2
else:
    i = 3
if i == 1:
    if y in list1:
        print("Yes")
    else:
        print("No")
elif i == 2:
    if y in list2:
        print("Yes")
    else:
        print("No")
else:
    if y in list3:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
l=[4,6,9,11]
count=0
if x!=2 and y!=2:
    for i in l:
        if x==i or y==i:
            count+=1
        
    if count==2:
        print('Yes')
    elif count==1:
        print('No')
    else:
        print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s1, s2, s3 = {1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}
c = set(map(int, input().split()))
if c<=s1 or c<=s2 or c<=s3:
  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")
elif x in g3 and y in g3:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
a=set([1,3,5,7,8,10,12])
b=set([4,6,9,11])
c=set([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:
import sys
input = sys.stdin.readline
print = sys.stdout.write
x, y = [int(_) for _ in input().split()]
a = [4, 6, 9, 11]
if x == 2 or y == 2:
    ans = "No"
elif x in a and y in a:
    ans = "Yes"
elif not x in a and not y in a:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
print = sys.stdout.write
x, y = [int(_) for _ in input().split()]
a = [4, 6, 9, 11]
if x == 2 or y == 2:
    ans = "No"
elif x in a and y in a:
    ans = "Yes"
elif not x in a and not y in a:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A - Grouping
x, y = [int(s) for s in input().split()]
groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

is_same = False

for group in groups:
    if x in group and y in group:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
x, y = map(int, input().split())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
l1 = [1, 3, 5, 7, 8, 10, 12]
l2 = [4, 6, 9, 11]
l3 = [2]
x, y = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check_exist(n):
    if list1.count(n)!=0:
        return 1
    elif list2.count(n)!=0:
        return 2
    else:
        return 3
x,y=map(int, input().split())
list1=[1,3,5,7,8,10,12]
list2=[4,6,9,11]
list3=[2]
check_x=check_exist(x)
check_y=check_exist(y)
if check_x==check_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:
  if y in A:
    print('Yes')
  else:print('No')
elif x in B:
  if y in B:
    print('Yes')
  else:print('No')
elif x == y == 2:
  print('Yes')
else:print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def group(n):
    a1 = [1,3,5,7,8,10,12]
    a2 = [4,6,9,11]
    a3 = [2]
    if n in a1:
        return 1
    if n in a2:
        return 2
    return 3

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