Problem:


Score : 100 points

Problem Statement

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

Constraints

x and y are integers.

1 ≤ x < y ≤ 12

Input

Input is given from Standard Input in the following format:

x y

Output

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

Sample Input 1

1 3

Sample Output 1

Yes

Sample Input 2

2 4

Sample Output 2

No



Sample input:
1 3


Sample output:
Yes

Submission status: Accepted

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

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

def checkGroup(num):
    if num in group_a:
        return 'a'
    elif num in group_b:
        return 'b'
    else :
        return 'c'
    
x_group = checkGroup(x)
y_group = checkGroup(y)

if x_group == y_group:
    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=set(list(map(int,input().split())))

if x <= a or x <= b or x <= c:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
if x 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())
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}
print('Yes' if d[x]==d[y] else 'No')

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Sun Mar 22 23:25:40 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

x, y = na()

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

Submission status: Accepted

Solution code:
grp=[-1,1,3,1,2,1,2,1,1,2,1,2,1]
x,y=map(int,input().split())
print("Yes" if grp[x]==grp[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]

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

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:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
X, Y = map(int, input().split())
print("Yes" if A[X-1] == A[Y-1] else "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 or x in b and y in b:
    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())
s = "No"
for l in g:
  if (x in l) and (y in l):
    s = "Yes"
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

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

if (a in A and b in A) or (a in B and b in B) or (a in C and b in C):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

for i in range(3):
    if x in g[i] and y in g[i]:
        print("Yes")
        exit()

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 = ""
for i in range(3):
    if (x in l[i]):
        if (y in l[i]):
            print("Yes")
            break
        else:
            print("No")
            break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = [int(i) for i in input().split()]
a = [0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1]

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

Submission status: Accepted

Solution code:
def func(a):
  if a in (1,3,5,7,8,10,12):
    return "a"
  elif a in (4,6,9,11):
    return "b"
  else:
    return "c"

x, y = [int(i) for i in input().split()]

x_group = func(x)
y_group = func(y)

if x_group == y_group:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

def func(x):
    if x in a:
        return 0
    if x in b:
        return 1
    if x in c:
        return 2
y,z=map(int,input().split())
if func(y)==func(z):
    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]
if x in list1 and y in list1:
  print("Yes")
elif x in list2 and y in list2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#import sys
#sys.setrecursionlimit(500000)　マージテクをちゃんとしていればこんなものはいらないはず……

class UF:
    #経路圧縮＋マージテクのunion find木
    def __init__(self,n):
        self.n = n
        self.parents = [-1] * (n+1) #1-indexedにするために１個足している
        self.rnks = [0] * (n+1)

    def find(self,n):
        if self.parents[n] < 0:
            return n
        else:
            return self.find(self.parents[n])


    def union(self,a,b):
        a_par = self.find(a)
        b_par = self.find(b)

        if a_par == b_par:
            return
        ##union by rank
        #if self.rnks[a_par] < self.rnks[b_par]: #ランクの高い方の根に低い方の根をつける　逆にしないように……！
        #    a_par,b_par = b_par,a_par
        #if self.rnks[a_par] == self.rnks[b_par]:
        #    self.rnks[a_par] += 1
        if self.size(a_par) < self.size(b_par): #parentsの値が負の数のとき、それはその木のサイズを表す。
            a_par,b_par = b_par,a_par
        self.parents[a_par] += self.parents[b_par]
        self.parents[b_par] = a_par

    def size(self,n):
        par = self.find(n)
        return abs(self.parents[par])

    def is_same(self,a,b):
        return self.find(a) == self.find(b)

def main():
    uf = UF(12)
    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())
    print("Yes" if uf.is_same(x,y) else "No")
    
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


x, y = MI()

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

Submission status: Accepted

Solution code:
list1 = [1,3,5,7,8,10,12]
list2 = [2]
list3 = [4,6,9,11] 
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:
#!/usr/bin/env python3
import sys


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


def solve(x: int, y: int):
    a = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
    print(YES if a[x] == a[y] else NO)


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
a = "D"
b = "D"
if x == 4 or x == 6 or x == 9 or x == 11:
  a = "A"
elif x == 2:
  a = "B"
else:
  a = "C"
if y == 4 or y == 6 or y == 9 or y == 11:
  b = "A"
elif y == 2:
  b = "B"
else:
  b = "C"
if a == b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

lst = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]

if lst[x - 1] == lst[y - 1]:
	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:
# A - Grouping
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
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")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
A=[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:
l1=[1,3,5,7,8,10,12]
l2=[4,6,9,11]

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

print("Yes" if ((a in l1 and b in l1) or (a in l2 and b in l2)) else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a, b = map(int,input().split())
g1 = [1,3,5,7,8,10,12]
g2 =  [4,6,9,11]
g3 = [2]

if a in g1 and b in g1:
    print('Yes')
elif a in g2 and b in g2:
    print('Yes')
elif a in g3 and b in g3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
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:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a=[1,3,5,7,8,10,12]
    b=[4,6,9,11]
    x,y=MI()
    if (x in a and y in a) or (x in b and y in b):
        print("Yes")
    else:
        print("No")

main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = [int(_) for _ in input().split()]
x = chr(x - 1 + ord('a'))
y = chr(y - 1 + ord('a'))
g = ['aceghjl', 'dfik', 'b']
flg = False
for i in range(3):
  if x in g[i] and y in g[i]:
    flg = True
print('Yes' if flg else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = (int(x) for x 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 in c and y in c:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

G = [0,1,3,1,2,1,2,1,1,2,1,2,1]

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

Submission status: Accepted

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

Submission status: Accepted

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

l = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 10, 11], [2]]
bool = False
for i in range(3):
    if x in l[i]:
        if y in l[i]:
            bool = True
            break
        
print('Yes' if bool else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

x,y=[int(i) for i in input().rstrip().split()]

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

for G in [g1,g2,g3] :
  if all( n in G for n in [x,y] ):
    print("Yes")
    break
else:
  print("No")

Submission status: Accepted

Solution code:
def chk3(n):
  if n==2:
    return True
  else:
    return False
def chk2(n):
  if n==4 or n==6 or n==9 or n==11:
    return True
  else:
    return False
def chk1(n):
  if n==1 or n==3 or n==5 or n==7 or n==8 or n==10 or n==12:
    return True
  else:
    return False
x,y=map(int,input().split())
if (chk3(x)==chk3(y) and chk3(x)==True) or (chk2(x)==chk2(y) and chk2(x)==True) or (chk1(x)==chk1(y) and chk1(x)==True):
  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:
  print('Yes')
elif x in l2 and y in l2:
  print('Yes')
elif x in l3 and y in l3:
  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())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
if x==2 or y==2:
    if x==y:
        print("Yes")
    else:
        print("No")
else:
    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())
check = [1,2,1,3,1,3,1,1,3,1,3,1]
if check[x-1]==check[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]
belong=[1,3,1,2,1,2,1,1,2,1,2,1]
print('Yes' if belong[x-1]==belong[y-1] 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]
def ans():
    while True:
        for l in A,B,C:
            if x in l and y in l:
                return 'Yes'
                break
        return 'No'
        break
print(ans())

Submission status: Accepted

Solution code:
def main():
    x, y = map(int, input().split())
    groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11]]
    for group in groups:
        if x in group and y in group:
            print("Yes")
            break
    else:
        print("No")


if __name__ == '__main__':
    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]
print("Yes" if x in g1 and y in g1 else "Yes" if x in g2 and y in g2 else "No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = [int(i) for i in input().rstrip().split(' ')]
num_list_1 = [1 ,3 , 5, 7, 8, 10, 12]
num_list_2 = [4, 6, 9, 11]
num_list_3 = [2]

if N in num_list_1 and M in num_list_1:
  print('Yes')
elif N in num_list_2 and M in num_list_2:
  print('Yes')
elif N ==  2 and M == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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())
n=[[1,3,5,7,8,10,12],[4,6,9,11],[2]]
ans="No"
for i in range(3):
    if x in n[i] and y in n[i]:
        ans="Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
elif a in c and y in c:
    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:
    print("Yes")
    exit()

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

if x==c and y==c:
    print("Yes")
    exit()

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]]
for i in l:
  if x in i and y in i:
    print("Yes")
    exit()
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:
#ABC062

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
set_xy = set(map(int, input().split()))
set1 = set((1,3,5,7,8,10,12))
set2 = set((4,6,9,11))

if set_xy | set1 == set1 or set_xy | set2 == set2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

group_1 = [1, 3, 5, 7, 8, 10, 12]
group_2 = [4, 6, 9, 11]

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

else:
    if x in group_1 and y in group_1:
        print("Yes")

    elif x in group_2 and y in group_2:
        print("Yes")

    else:
        print("No")

Submission status: Accepted

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

if x in a and y in a:
    print("Yes")
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,B=map(int,input().split())
if A==2 or B==2:
	print("No")
elif A==4 or A==6 or A==9 or A==11:
	if B==4 or B==6 or B==9 or B==11:
		print("Yes")
	else:
		print("No")
else:
	if B==4 or B==6 or B==9 or B==11:
		print("No")
	else:
		print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

if x == y == 2:
    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:
# AtCoder Beginner Contest 062
# A - Grouping
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:
g0={1,3,5,7,8,10,12}
g1={4,6,9,11}
s=set(map(int,input().split()))
print('Yes' if s<g0 or s<g1 else 'No')

Submission status: Accepted

Solution code:
g0 = {1,3,5,7,8,10,12}
g1 = {4,6,9,11}
s = set(map(int,input().split()))
print('Yes' if s<g0 or s<g1 else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    xy = tuple(map(int, input().split()))

    g1 = (1, 3, 5, 7, 8, 10, 12)
    g2 = (4, 6, 9, 11)

    if(len(set(xy) & set(g1)) == 2):
        print("Yes")
    elif(len(set(xy) & set(g2)) == 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]
print('Yes') if (x in a and y in a) or (x in b and y in b) 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 == 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]
print("Yes"*((x in A and y in A)+(x in B and y in B)+(x==y==2)) or "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]
s=[x,y]

if (len(set(g1)-set(s))==(len(g1)-len(s)))or(len(set(g2)-set(s))==(len(g2)-len(s)))or(len(set(g3)-set(s))==(len(g3)-len(s))):
    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]]
f=False
for i in l:
    if (x in i)and(y in i):
        f=True
if f:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

print("No")

Submission status: Accepted

Solution code:
# 入力 : 数字2つ
x, y = map(int, input().split())

# 出力　x, y が同一のグループに属しているか判定してください。

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def group(x , y):

    gx = 0
    gy = 0

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

    for i in range(3):
        if groups[i].count(x) != 0:
            gx = i
        if groups[i].count(y) != 0:
            gy = i

    return "Yes" if gx == gy else "No"

def main():
    x , y = map(int , input().split())
    print(group(x , y))
 
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A={1, 3, 5, 7, 8, 10, 12}
B={4, 6, 9, 11}
x = set(map(int, input().split()))
print("Yes" if x <= A or x <= B else "No")