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

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

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

Solution (Python):
x,y = list(map(int,input().split()))
lst = [0,1,3,1,2,1,2,1,1,2,1,2,1]
if lst[x] == lst[y]:
    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):
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys




read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

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


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

Solution (Python):
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
if x==2 or y==2:
    print('No')
elif (x in a) ==  (y in a):
    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')
else :
    print('No')

Solution (Python):
x, y = input().split()
dic = {"1": "A", "2": "C", "3": "A", "4": "B", "5": "A",
       "6": "B", "7": "A", "8": "A", "9": "B", "10": "A", "11": "B", "12": "A"}
if dic[x] == dic[y]:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

x, y = MAP()

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

for l in [gA, gB, gC]:
	if x in l and y in l:
		print("Yes")
		break
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 or x in b and y in b or x in c and y in c:
    print('Yes')
else:
    print('No')

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

Solution (Python):
x,y = map(int, input().split())
Z = [4,6,9,11]
if x in Z or y in Z:
    b = x in Z and y in Z
elif x == 2 or y == 2:
    b = x == y == 2
else:
    b = x not in ([2]+Z) and y not in ([2]+Z)
print("YNeos"[not b::2])

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

Solution (Python):
d = {}
d[1] = 1
d[2] = 3
d[3] = 1
d[4] = 2
d[5] = 1
d[6] = 2
d[7] = 1
d[8] = 1
d[9] = 2
d[10] = 1
d[11] = 2
d[12] = 1
x,y = map(int,input().split())
ans = 'No'
if d[x] == d[y]:
    ans = 'Yes'
print(ans)

Solution (Python):
def main():
    from sys import stdin, setrecursionlimit
    
    
    r = stdin.readline()[:-1]
    
    
    
    
    a = list(map(int, r.split()))
    
    
    

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

    x = [0]*2
    for i in range(len(a)):
        if a[i] in g1:
            x[i] = 1
        elif a[i] in g2:
            x[i] = 2
        elif a[i] in g3:
            x[i] = 3
    if x[0] != 0 and x[0] == x[1]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

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

if x in la and y in la or x in lb and y in lb or x in lc and y in lc:
    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):
x1, x2 = map(int, input().split())

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

if (x1 in l1) & (x2 in l1):
  print("Yes")
elif (x1 in l2) & (x2 in l2):
  print("Yes")
elif (x1 in l3) & (x2 in l3):
  print("Yes")
else:
  print("No")

Solution (Python):
import sys
input = sys.stdin.readline
x,y= [int(i) for i in input().split()]
a1 = [1,3,5,7,8,10,12]
a2 = [4,6,9,11]
a3 = [2]
if x in a1 :
    if y in a1 :
        print("Yes")
    else :
        print("No")
elif x in a2 :
    if y in a2 :
        print("Yes")
    else :
        print("No")
elif x == 2 :
    if y == 2:
        print("Yes")
    else :
        print("No")

Solution (Python):
import sys
input = sys.stdin.readline
x,y= [int(i) for i in input().split()]
a1 = [1,3,5,7,8,10,12]
a2 = [4,6,9,11]
a3 = [2]
if x in a1 :
    if y in a1 :
        print("Yes")
    else :
        print("No")
elif x in a2 :
    if y in a2 :
        print("Yes")
    else :
        print("No")
elif x == 2 :
    if y == 2:
        print("Yes")
    else :
        print("No")

Solution (Python):
S="ACABABAABABA"
a,b = map(int,input().split())
print("Yes" if S[a-1]==S[b-1] else "No")

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

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

a = {1, 3, 5, 7, 8, 10, 12}
b = {4, 6, 9, 11}

print('Yes' if x <= a or x <= b else 'No')

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

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

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

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

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

Solution (Python):
d = [1,3,5,7,8,10,12]
s = [4,6,9,11]
a = [2]

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

if (x in d and y in d) or (x in s and y in s) or (x in a and y in a):
    print("Yes")
else:
    print("No")

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

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

group_a = [1, 3, 5, 7, 8, 10, 12]
group_b = [4, 6, 9, 11]
x_y = [x, y]

if all([i in group_a for i in x_y]) or all([i in group_b for i in x_y]) or (x == 2 and y == 2):
    print('Yes')
else:
    print('No')

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

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

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


if x == y:
	print("Yes")
elif x in l and y in l or x in t and y in t:
	print("Yes")
else:
	print("No")

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

Solution (Python):
import sys
input = sys.stdin.readline
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]
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):
a, b = map(int, input().split())
lst = [4, 6, 9, 11]
lst2 = [1, 3, 5, 7, 8, 10, 12]
if a==b==2:
  print('Yes')
elif a in lst and b in lst:
  print('Yes')
elif a in lst2 and b in lst2:
  print('Yes')
else:
  print('No')

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

if x in grp1 and y in grp1:
    print('Yes')
elif x in grp2 and y in grp2:
    print('Yes')
elif x in grp3 and y in grp3:
    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]

r = 'No'
if x in a and y in a:
  r = 'Yes'
if x in b and y in b:
  r = 'Yes'
if x in c and y in c:
  r = 'Yes'
  
print(r)

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


import numpy as np
import fractions as fra


import calendar
def c(n):
    return calendar.monthrange(2019,n)[1]

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

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

Solution (Python):


import numpy as np
import fractions as fra



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

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

Solution (Python):
lst1 = [1, 3, 5, 7, 8, 10, 12]
lst1_s = list(map(str, lst1))
lst2 = str([4, 6, 9, 11])
lst2_s = list(map(str, lst2))
lst3 = str([2])
lst3_s = list(map(str, lst3))

num = input().split()
a, b = num

if (a in lst1_s and b in lst1_s):
    print('Yes')
elif(a in lst2_s and b in lst2_s):
    print('Yes')
elif(a in lst3_s and b in lst3_s):
    print('Yes')
else:
    print('No')

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

if a in list1 and b in list1:
  print("Yes")
elif a in list2 and b in list2:
  print("Yes")
elif a in list3 and b in list3:
  print("Yes")
else: 
  print("No")

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

for S in [A, B, C]:
    if x in S and y in S:
        print('Yes')
        break
else:
    print('No')

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

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

if (x in aG and y in aG) or (x in bG and y in bG) or (x in cG and y in cG):
  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:
    print("Yes")
elif x in g2 and y in g2:
    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) or (x in b and y in b) or (x==2 and b==2):
    print('Yes')
else:
    print('No')

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

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

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

if x == 2 or y == 2:
  print('No')
  exit()
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')
  else:
    print('No')
else:
  if y == 4 or y == 6 or y == 9 or y == 11:
    print('No')
  else:
    print('Yes')

Solution (Python):
xyz=[0,2,0,1,0,1,0,0,1,0,1,0]
a,b=map(int,input().split())
print("Yes" if xyz[a-1]==xyz[b-1] else "No")

Solution (Python):
def search_group(a):
    if a in zone_one:
        ret = 1
    elif a in zone_two:
        ret = 2
    else:
        ret = 3
    return ret

zone_one = {1,3,5,7,8,10,12}
zone_two = {4,6,9,11}
zone_three = {2}

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

ret_x = search_group(x)
ret_y = search_group(y)

if ret_x == ret_y:
    print("Yes")
else:
    print("No")

Solution (Python):
x=[1,3,5,7,8,10,12]
y=[4,6,9,11]
z=[2]

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
x, y = [int(x) for x in 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")
        sys.exit()
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)) or ((x in b) and (y in b)):
  print('Yes')
else:
  print('No')

Solution (Python):
x, y = map(int, input().split())
if(x==y): print("Yes")
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, b = map(lambda x: int(x), input().split())

g = [4, 6, 9, 11]
go = [1, 3, 5, 7, 8, 10, 12]

if a == 2 and b == 2:
  print('Yes')
elif a in g and b in g:
  print('Yes')
elif a in go and b in go:
  print('Yes')
else:
  print('No')

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

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

Solution (Python):
x, y = input().split()
A = ['1', '3', '5', '7', '8', '10', '12']
B = ['4', '6', '9', '11']
if x == 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())

group = [0]*13
group[2] = 1 
for i in (4,6,9,11): 
  group[i] = 2
  
print("Yes" if group[x] == group[y] else "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())

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

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

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

print("Yes" if a==b else "No")

Solution (Python):
g = [1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

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

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

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


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


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

Solution (Python):
x,y=map(int,input().split())
if x==1 or x==3 or x==5 or x== 7 or x==8 or x==12 or x==10:
    if y==1 or y==3 or y==5 or y==7 or y==8 or y==10 or y==12:
        print('Yes')
    else:
        print('No')
elif 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')
    else:
        print('No')
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 a.count(x)==a.count(y) and b.count(x)==b.count(y) and c.count(x)==c.count(y):
  print('Yes')
else:
  print('No')

Solution (Python):
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:
  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())
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 == 2 and y ==2:
    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):
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): 
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

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

def divisors(a): 
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): 
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): 
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): 
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

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

if __name__=='__main__':
    main()

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

Solution (Python):
x,y= map(int,input().split())
if x==2 or y ==2:
  print('No')
elif x in [4,6,9,11] and y in [4,6,9,11]:
  print('Yes')
elif x not in [4,6,9,11] and y not in [4,6,9,11]:
  print('Yes')
else:
  print('No')

Solution (Python):
import sys

s1 = {1,3,5,7,8,10,12}
s2 = {4,6,9,11}

t = set(map(int,input().split()))
for s in [s1, s2]:
  if len(t&s)==2:
    print('Yes')
    sys.exit()

print('No')

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

print(ans)

Solution (Python):
x,y = input().split()
a_list = ["1","3","5","7","8","10","12"]
b_list = ["4","6","9","11"]
ans = "No"
if x in a_list and y in a_list:
	ans = "Yes"
elif x in b_list and y in b_list:
	ans = "Yes"
print(ans)

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 = [int(i) for i in input().split()]

"""
if x == 2 or y == 2:
    print("No")
elif (x == 4 or x == 6 or x == 9) and (y == 6 or y == 9 or y == 11):
    print("Yes")
elif (x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10) and (y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12):
    print("Yes")
else:
    print("No")
"""

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

for i in range(7):
    if A[i] == x:
        for j in range(i,7):
            if A[j] == y:
                tmp = True
for i in range(4):
    if B[i] == x:
        for j in range(i,4):
            if B[j] == y:
                tmp = True
if tmp:
    print("Yes")
if not tmp:
    print("No")
"""

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 = [int(i) for i in input().split()]


if x == 2 or y == 2:
    print("No")
elif (x == 4 or x == 6 or x == 9) and (y == 6 or y == 9 or y == 11):
    print("Yes")
elif (x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10) and (y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12):
    print("Yes")
else:
    print("No")

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

for i in range(7):
    if A[i] == x:
        for j in range(i,7):
            if A[j] == y:
                tmp = True
for i in range(4):
    if B[i] == x:
        for j in range(i,4):
            if B[j] == y:
                tmp = True
if tmp:
    print("Yes")
if not tmp:
    print("No")
"""

Solution (Python):

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

"""
if x == 2 or y == 2:
    print("No")
elif x == 4 or x == 6 or x == 9 and y == 6 or y == 9 or y == 11:
    print("Yes")
elif x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10　and y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
    print("Yes")
else:
    print("No")
"""

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

for i in range(7):
    if A[i] == x:
        for j in range(i,7):
            if A[j] == y:
                tmp = True
for i in range(4):
    if B[i] == x:
        for j in range(i,4):
            if B[j] == y:
                tmp = True
if tmp:
    print("Yes")
if not tmp:
    print("No")

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

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

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

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

if __name__ == '__main__':
    main()

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]
c = [2]
if x in a and y in a:
    print('Yes')
    import sys
    sys.exit()
if x in b and y in b:
    print('Yes')
    import sys
    sys.exit()
if x in c and y in c:
    print('Yes')
    import sys
    sys.exit()
print('No')

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

m = [0, 0, 2, 0, 1, 0, 1, 0, 0, 1,  0,  1,  0]
print('Yes' if m[x]==m[y] else 'No')

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

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

else:
    print('No')

Solution (Python):
import sys

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

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

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

if __name__ == '__main__':
    ans = main()
    print(ans)

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

Solution (Python):
import sys

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

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

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

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

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
mod = 10**9+7
ans = 0 ;count = 0 ;pro = 1
n=20
class UnionFind:
    __slots__ = ['id','sz']

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

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

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

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

uf=UnionFind(13)
uf.union(1,3)
uf.union(1,5)
uf.union(1,7)
uf.union(1,8)
uf.union(1,10)
uf.union(1,12)
uf.union(4,6)
uf.union(4,9)
uf.union(4,11)
x,y=map(int,input().split())
if uf.find(x,y):
    print("Yes")
else:
    print("No")

Solution (Python):
x,y=map(int,input().split())
g=[[1,3,5,7,8,10,12],[2],[4,6,9,11]]
def check(num):
    g_num=0
    for i in range(1,3):
        if num in g[i]:
            g_num=i
            break
    return g_num
if check(x)==check(y):
    print("Yes")
else:
    print("No")

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

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

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

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

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

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