Problem:


Score : 100 points

Problem Statement

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

Constraints

x and y are integers.

1 ≤ x < y ≤ 12

Input

Input is given from Standard Input in the following format:

x y

Output

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

Sample Input 1

1 3

Sample Output 1

Yes

Sample Input 2

2 4

Sample Output 2

No



Sample input:
1 3


Sample output:
Yes

Submission status: Accepted

Solution code:

x,y = map(int,input().split())
grp = [0]*13
grp[2] = 1 # 2 をグループ番号１に
for i in [4,6,9,11]: # 4,6,9,11 をグループ番号２に
  grp[i] = 2
print('Yes' if grp[x] == grp[y] else 'No')

Submission status: Accepted

Solution code:
group_1=[1,3,5,7,8,10,12]
group_2=[4,6,9,11]
group_3=[2]
groups=[group_1,group_2,group_3]

a,b=input().split()

a=int(a)
b=int(b)

for i in range(len(groups)):
  if(a in groups[i] and b in groups[i]):
    print("Yes")
    break
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

x, y = MAP()

for l in [gA, gB, gC]:
	if x in l and y in l:
		print("Yes")
		break
else:
	print("No")

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

x, y = MAP()

if any(x in k and y in k for k in [A, B, 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:
    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:
n = input().split()
x = int(n[0])
y = int(n[1])
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if (x in a) == True and (y in a) == True:
  print('Yes')
elif (x in b) == True and (y in b) == True:
  print('Yes')
elif (x in c) == True and (y in 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]
c = [2]

for i in [a, b, c]:
    if x in i and y in i:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
count=0
l=[1,3,5,7,8,10,12]
r=[4,6,9,11]
result='No'
for i in l:
    if i==x or i==y:
        count+=1
if count==2:
    result='Yes'
count=0
for c in r:
    if c==x or c==y:
        count+=1
if count==2:
    result='Yes'
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def group(x):
    if x in [1, 3, 5, 7, 8, 10, 12]:
        return "A"
    if x in [4, 6, 9, 11]:
        return "B"
    if x in [2]:
        return "C"


x, y = map(int, readline().split())
ans = 'Yes' if group(x) == group(y) else 'No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
group = [-1, 0, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 0]
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())


def group(n):
    if n in [1, 3, 5, 7, 8, 10, 12]:
        return 1
    elif n in [4, 6, 9, 11]:
        return 2
    else:
        return 3


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

Submission status: Accepted

Solution code:
def main():
  num = list(map(int,input().split()))
  if (num[0] in [1,3,5,7,8,10,12] and num[1] in [1,3,5,7,8,10,12] ) or (num[0] in [4,6,9,11] and num[1] in [4,6,9,11] ) or (num[0] ==2 and num[1] ==2):
    print('Yes')
  else:
    print('No')
      
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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


if __name__ == '__main__':
    resolve()

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

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

if x in al:
    if y in al:
        print("Yes")
    else:
        print("No")
        
elif x in bl:
    if y in bl:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    class UnionFind:
        def __init__(self,n):
            self.par=[i for i in range(n)]
            self.siz=[1]*n
            
        def root(self,x):
            while self.par[x]!=x:
                self.par[x]=self.par[self.par[x]]
                x=self.par[x]
            return x
        
        def unite(self,x,y):
            x=self.root(x)
            y=self.root(y)
            if x==y:
                return False
            if self.siz[x]<self.siz[y]:
                x,y=y,x
            self.siz[x]+=self.siz[y]
            self.par[y]=x
            return True
        
        def is_same(self,x,y):
            return self.root(x)==self.root(y)
        
        def size(self,x):
            return self.siz[self.root(x)]
    u=UnionFind(13)
    for x in [3,5,7,8,10,12]:
        u.unite(1,x)
    for x in [6,9,11]:
        u.unite(4,x)
    x,y=map(int,input().split())
    YesNo(u.is_same(x,y))

if __name__ == '__main__':
    main()

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 (l.count(x) > 0 and l.count(y) == 0) or (l.count(x) == 0 and l.count(y) > 0):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if x == 2 or y == 2:
    print('No')
elif x in group[0]:
    if y in group[0]:
        print('Yes')
    else:
        print('No')
elif x in group[1]:
    if y in group[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 a.count(x) != 0 and a.count(y) != 0:
    print('Yes')
elif b.count(x) != 0 and b.count(y) != 0:
    print('Yes')
elif c.count(x) != 0 and c.count(y) != 0:
    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())
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]
c = [2]
if a.count(x)*a.count(y) == 1 or b.count(x)*b.count(y) == 1 or c.count(x)*c.count(y):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
print(['No', 'Yes'][(x in g1 and y in g1) or (x in g2 and y in g2)])

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

a,b = inputIL()

dic = {
  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 dic[a] == dic[b]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

    print(ans)


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]

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

x,y = map(int,input().split())
if x in array1 and y in array1:
    print('Yes')
    exit()

if x in array2 and y in array2:
    print('Yes')
    exit()

if x in array3 and y in array3:
    print('Yes')
    exit()

print('No')

Submission status: Accepted

Solution code:
import sys
import math
import bisect

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

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 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:
A = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = map(int, input().split())
flg = 0
for a in A:
    if x in a and y in a:
        flg = 1

if flg == 1:
    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')
elif (x==y and x==2): print('Yes')
else: print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Between Two Integers
def ABC_61_A():
    x,y = map(int, input().split())
    list1 = [1,3,5,7,8,10,12]
    list2 = [4,6,9,11]
    
    if (list1.count(x) == 1 and list1.count(y) == 1) or (list2.count(x) == 1 and list2.count(y) == 1) :
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':

    ABC_61_A()

Submission status: Accepted

Solution code:
#Between Two Integers
def ABC_61_A():
    x,y = map(int, input().split())
    list1 = [1,3,5,7,8,10,12]
    list2 = [4,6,9,11]
    list3 = [2]
    
    if list1.count(x) == 1 and list1.count(y) == 1:
        print('Yes')
    elif list2.count(x) == 1 and list2.count(y) == 1:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':

    ABC_61_A()

Submission status: Accepted

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

for i in xy:
    if i in alist:
        ans.append(0)
    if i in blist:
        ans.append(1)
    if i in clist:
        ans.append(2)

if ans[0]==ans[1]:
    print("Yes")
else:print("No")

Submission status: Accepted

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

if(x==1 or x== 3 or x==5 or x==7 or x==8 or x==10 or x==12)and(y==1 or y== 3 or y==5 or y==7 or y==8 or y==10 or y==12):
    print('Yes')
elif(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')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

def ok(x, y, group):
    return (x in group) and (y in group)

if ok(x, y, gA):
    print("Yes")
elif ok(x, y, gB):
    print("Yes")
elif ok(x, y, gC):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    x,y = (int(x) for x in 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')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

nums=[None]*12
for i in a:
  nums[i-1]="a"
for i in b:
  nums[i-1]="b"
for i in c:
  nums[i-1]="c"
x,y=map(int,input().split())
if nums[x-1]==nums[y-1]:
  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}
xy=set(map(int,input().split()))
if xy.issubset(a) or xy.issubset(b) or xy.issubset(c):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1 = (1, 3, 5, 7, 8, 10, 12)
a2 = (4, 6, 9, 11)
a, b = map(int, input().split())
if a == 2 or b == 2:
    print("No")
    exit()
f = 1
if a in a1 and b in a1:
    f = 0
if a in a2 and b in a2:
    f = 0
print("YNeos"[f::2])

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

while True:
    if x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12:
        if y == 1 or y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
            print("Yes")
            break

    if x == 4 or x == 6 or x == 9 or x == 11:
        if y == 4 or y == 6 or y == 9 or y == 11:
            print("Yes")
            break

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

    print("No")
    break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

set1={1,3,5,7,8,10,12}
set2={4,6,9,11}
set3={2}

if x in set1 and y in set1:
  print("Yes")
elif x in set2 and y in set2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
D,E = list(map(int,input().split()))
if D in A and E in A:
    print("Yes")
    exit()
elif D in B and E in B:
    print("Yes")
    exit()
elif D in C and E in C:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

group = ['a', 'c', 'a', 'b', 'a', 'b', 'a', 'a', 'b', 'a', 'b', 'a']

if group[x-1] == group[y-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=input().split()
list1={"1":1,"2":3,"3":1,"4":0,"5":1,"6":0,"7":1,"8":1,"9":0,"10":1,"11":0,"12":1}
c=list1[a]
d=list1[b]
if str(c)==str(d):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=input().split()
x=int(x)
y=int(y)
if x==2 | y==2:
    print('No')
    exit()
lt1=[1,3,5,7,8,10,12]
lt2=[4,6,9,11]
if (lt1.count(x)==1 and lt1.count(y)==1) or (lt2.count(x)==1 and lt2.count(y)==1):
    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]

num = list(map(int, input().split()))
x = num[0]
y = num[1]

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

Submission status: Accepted

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

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