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

Solution (Python):


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

Solution (Python):
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')

Solution (Python):
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")

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

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

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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')

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

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

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

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

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):

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

Solution (Python):
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")

Solution (Python):



class UF:
    
    def __init__(self,n):
        self.n = n
        self.parents = [-1] * (n+1) 
        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
        
        
        
        
        
        if self.size(a_par) < self.size(b_par): 
            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()

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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')

Solution (Python):

import sys


YES = "Yes"  
NO = "No"  


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))  
    y = int(next(tokens))  
    solve(x, y)


if __name__ == '__main__':
    main()

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):

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

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):


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

Solution (Python):
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')

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

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):

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

Solution (Python):
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')

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

Solution (Python):


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

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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')

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

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

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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')

Solution (Python):
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")

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

Solution (Python):
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')

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

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

Solution (Python):
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')

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
print(["Yes","No"][input().count("2")])

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):


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

Solution (Python):
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')

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):


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

Solution (Python):
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')

Solution (Python):
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')

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
s = "nACABABAABABA"
a,b =map(int,input().split())
if s[a] == s[b]:
    print("Yes")
else:
    print("No")

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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')

Solution (Python):
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')

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):

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



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

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

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

Solution (Python):
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")

Solution (Python):
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")

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

Solution (Python):
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")

Solution (Python):
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")

Solution (Python):
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")

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

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

Solution (Python):
d = [-1, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
x, y = tuple(map(int, input().split()))
if d[x] == d[y]:
    print('Yes')
else:
    print('No')

Solution (Python):
set1={1,3,5,7,8,10,12}
set2={4,6,9,11}
set3={2}
x,y=map(int,input().split())
if x in set1 and y in set1:
  print('Yes')
elif x in set2 and y in set2:
  print('Yes')
else:
  print('No')

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

if A.count(a) + A.count(b) == 2 or B.count(a) + B.count(b) == 2 or C.count(a) + C.count(b) == 2: print("Yes")
else: print("No")

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

Solution (Python):
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')

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

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

Solution (Python):




def main():
    X, Y = map(int, input().split())
    A = [1, 3, 5, 7, 8, 10, 12]
    B = [4, 6, 9, 11]
    C = [2]
    print('Yes' if any([(X in A and Y in A),
                        (X in B and Y in B),
                        (X in C and Y in C)])else 'No')


if __name__ == "__main__":
    main()

Solution (Python):
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")

Solution (Python):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

s=[[1,3,5,7,8,10,12],[4,6,9,11],[2]]
uf=UnionFind(13)
for i in range(len(s)):
    for j in range(len(s[i])):
        uf.union(s[i][0],s[i][j])

x,y=map(int,input().split())
if uf.same(x,y):
    print("Yes")
else:
    print("No")

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

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

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

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

lst1 = [1, 3, 5, 7, 8, 10, 12]
lst2 = [4, 6, 9, 11]

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

print ('No')

Solution (Python):
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')

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

Solution (Python):
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
a,b = map(int,input().split())
f = False
if a in l1 and b in l1:
  f = True
if a in l2 and b in l2:
  f = True
print("Yes" if f else "No")