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: Wrong Answer

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

import sys

input = [int(i) for i in sys.stdin.readline().split(' ')]
input_matrix = []

for i in range(input[0]):
	input_matrix.append(sys.stdin.readline().replace('\n',''))

for i in range(input[1] + 2):
	print('#',end='')
print()

for i in range(input[0]):
	print('#',end='')
	print(input_matrix[i],end='')
	print('#',)
	
for i in range(input[1] + 2):
	print('#',end='')

Submission status: Wrong Answer

Solution code:
def group(inp):
    if inp ==  '4' or inp == '6' or input == '9' or inp == '11':
        return 2
    if inp == '2':
        return 3
    else:
        return 1

x, y = input().split()
if group(x) == group(y):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math
import sys
 
T = list(map(int, input().split()))
S = T[0] * T[1]
 
if ((T[0] % 3 == 0) or (T[1] % 3 == 0)):
    print(0)
    sys.exit()
 
minS = 100000000000
for i in range(1, math.ceil(T[0]/2)):
    A = i * T[1]
    F = math.floor(T[1] / 2) * (T[0] - i)
    C = S - (A + F)
    if (F == C):
        minS = min(minS, abs(A - F))
        continue
    else:
        if (A > C):
            minS = min(minS, abs(A - F))
        elif(C >= A and A >= F):
            minS = min(minS, abs(C - F))
        else:
            minS = min(minS, abs(C - A))
    A = i * T[0]
    F = math.floor(T[0] / 2) * (T[1] - i)
    C = S - (A + F)
    if (F == C):
        minS = min(minS, abs(A - F))
        continue
    else:
        if (A > C):
            minS = min(minS, abs(A - F))
        elif(C >= A and A >= F):
            minS = min(minS, abs(C - F))
        else:
            minS = min(minS, abs(C - A))
 
for i in range(1, math.ceil(T[1]/2)):
    A = i * T[1]
    F = math.floor(T[1] / 2) * (T[0] - i)
    C = S - (A + F)
    if (F == C):
        minS = min(minS, abs(A - F))
        continue
    else:
        if (A > C):
            minS = min(minS, abs(A - F))
        elif(C >= A and A >= F):
            minS = min(minS, abs(C - F))
        else:
            minS = min(minS, abs(C - A))
    A = i * T[0]
    F = math.floor(T[0] / 2) * (T[1] - i)
    C = S - (A + F)
    if (F == C):
        minS = min(minS, abs(A - F))
        continue
    else:
        if (A > C):
            minS = min(minS, abs(A - F))
        elif(C >= A and A >= F):
            minS = min(minS, abs(C - F))
        else:
            minS = min(minS, abs(C - A))
 
print(minS)

Submission status: Wrong Answer

Solution code:
def solve():
    x,y=map(int,input().split())
    a=min(x,y)
    b=max(x,y)
    if a==2 or b==2:
        print("No")
    elif (a==4 and not(b==6 or b==9 or b==11)) or (a==6 and not(b==9 or b==11)) or (a==9 and not b==11):
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
h, w = [int(n) for n in input().split()]
i = min(h, w)
j = max(h, w)
area = i * j
if i % 3 == 0 or j % 3 == 0:
    print(0)
else:
    p = j // 3 + 1
    pp = i // 3 + 1
    q = j // 3 - 1
    qq = i // 3 - 1
    a1 = i * p
    aa1 = j * p
    a2 = i * q
    aa2 = j * q
    b1 = i // 2 * (j - p)
    bb1 = j // 2 * (i - p)
    b2 = i // 2 * (j - q)
    bb2 = j // 2 * (i - q)
    c1 = (j - p) // 2 * i
    cc1 = (i - p) // 2 * j
    c2 = (j - q) // 2 * i
    cc2 = (i - q) // 2 * j
    tup=[(a1,b1),(a2,b2),(aa1,bb1),(aa2,bb2),
        (a1,c1),(a2,c2),(aa1,cc1),(aa2,cc2)]
    lst=[abs(max(a,b,area-a-b)-min(a, b, area - a - b)) for a,b in tup]
    print(min(lst))

Submission status: Wrong Answer

Solution code:
h, w = [int(n) for n in input().split()]
i = min(h, w)
j = max(h, w)
area = i * j
if i % 3 == 0 or j % 3 == 0:
    print(0)
else:
    p = j // 3 + 1
    pp = i // 3 + 1
    q = j // 3 - 1
    qq = i // 3 - 1
    a1 = i * p
    aa1 = j * p
    a2 = i * q
    aa2 = j * q
    b1 = i // 2 * (j - p)
    bb1 = j // 2 * (i - p)
    b2 = i // 2 * (j - q)
    bb2 = j // 2 * (i - q)
    c1 = (j - p) // 2 * i
    cc1 = (i - p) // 2 * j
    c2 = (j - q) // 2 * i
    cc2 = (i - q) // 2 * j

    print(min(
        abs(max(a1, b1, area - a1 - b1) - min(a1, b1, area - a1 - b1)),
        abs(max(aa1, bb1, area - aa1 - bb1) - min(aa1, b1, area - aa1 - bb1)),
        abs(max(aa2, bb2, area - aa2 - bb2) - min(aa2, bb2, area - aa2 - bb2)),
        abs(max(a2, b2, area - a2 - b2) - min(a2, b2, area - a2 - b2)),
        abs(max(a1, c1, area - a1 - c1) - min(a1, c1, area - a1 - c1)),
        abs(max(aa1, cc1, area - aa1 - cc1) - min(aa1, c1, area - aa1 - cc1)),
        abs(max(aa2, cc2, area - aa2 - cc2) - min(aa2, cc2, area - aa2 - cc2)),
        abs(max(a2, c2, area - a2 - c2) - min(a2, c2, area - a2 - c2))

    ))

Submission status: Wrong Answer

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

if ipt[0] == ipt[1]:
    print(True)
else:
    if ipt[0] in a:
        print(ipt[1] in a)
    else:
        if ipt[0] in b:
            print(ipt[1] in b)

Submission status: Wrong Answer

Solution code:

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

def samelst_judge(x,y):
    if x in lst1:
        if y in lst1:
            print("Yes")
    elif x in lst2:
        if y in lst2:
            print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

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]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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: Wrong Answer

Solution code:
# coding=utf-8
import sys
def main(nums):

    g1=[1,3,5,7,8,10,12]
    g2=[4,6,11]
    if len(nums) != 2:
        sys.exit()

    if 2 in nums:
        return "No"

    if nums[0] in g1:
        if nums[1] in g1:
            return "Yes"
        else:
            return "No"

    if nums[0] in g2:
        if nums[1] in g2:
            return "Yes"
        else:
            return "No"
    else:
        return "No"


if __name__ == '__main__':
    input_line1 = raw_input()
    s_line = input_line1.split(" ")
    nums = map(int, s_line)
    print main(nums)

Submission status: Wrong Answer

Solution code:
# coding=utf-8
input_line1 = raw_input()
s_line = input_line1.split(" ")

nums = map(int, s_line)
g1=[1,3,5,7,8,10,12]
g2=[4,6,11]


if nums[0] in g1:
    if nums[1] in g1:
        print "Yes"
    else:
        print "No"

if nums[0] in g2:
    if nums[1] in g2:
        print "Yes"
    else:
        print "No"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
# coding=utf-8
import sys
input_line1 = raw_input()
s_line = input_line1.split(" ")

nums = map(int, s_line)
g1=[1,3,5,7,8,10,12]
g2=[4,6,11]
g3=[2]

if len(nums) != 2:
    sys.exit()

if 2 in nums:
    print "No"
else:

    if nums[0] in g1:
        if nums[1] in g1:
            print "Yes"
        else:
            print "No"

    if nums[0] in g2:
        if nums[1] in g2:
            print "Yes"
        else:
            print "No"
    else:
        print "No"

Submission status: Wrong Answer

Solution code:
# coding=utf-8
import sys
input_line1 = raw_input()
s_line = input_line1.split(" ")

nums = map(int, s_line)
g1=[1,3,5,7,8,10,12]
g2=[4,6,11]
g3=[2]

if len(nums) != 2:
    sys.exit()

if 2 in nums:
    print "No"
else:

    if nums[0] in g1:
        if nums[1] in g1:
            print "Yes"
        else:
            print "No"

    if nums[0] in g2:
        if nums[1] in g2:
            print "Yes"
        else:
            print "No"

Submission status: Wrong Answer

Solution code:
def solve():
    x, y = map(int, input().split())
    a = [0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1]
    if a[x] == a[y]:
        ans = "YES"
    else:
        ans = "NO"
    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

def inn(x):
	xin = ''
	if x in a:
		xin = 'a'
	elif x in b:
		xin = 'b'
	else:
		xin = 'c'
	return xin

if inn(x) and inn(y):
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
def flg_fun(a):
    if a in [1,3,5,7,8,10,12]:
        b=1
    else:
        if a==2:
            b=2
        else:
            b=3
    return b


def assign_fun(x, y):
    if x==y:
        print("Yes")
    else:
        if flg_fun(x)==flg_fun(y):
            print("Yes")
        else:
            print("No")

a = input().split(" ")
assign_fun(a[0], a[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def f(a):
    if a in [1,3,4,7,8,10,12]:
        return 1
    if a in [4,6,9,11]:
        return 2
    if a == 2:
        return 3
    return None

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

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
if x in [1,3,5,7,8,20,12]:
    x=1
elif x in [4,6,9,11]:
    x=2
else:
    x=3
if y in [1,3,5,7,8,20,12]:
    y=1
elif y in [4,6,9,11]:
    y=2
else:
    y=3

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

Submission status: Wrong Answer

Solution code:
import math
h, w = map(int, input().split())
low = min(h, w)
high = max(h, w)

if h%3 == 0 or w%3 == 0:
    print (0)
elif int(high/3) > low:
    print ((high % 3)*low)
else:
    a = math.ceil(high/3)*low
    b = (high-math.ceil(high/3))*int(low/2)
    c = abs(a-b)

    a = round(high/3)*low
    b = (high-round(high/3))*int(low/2)
    d = abs(a-b)

    print (min(c, d))

Submission status: Wrong Answer

Solution code:
G = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
input_line = raw_input()
num = input_line.split(" ")
x = int(num[0])
y = int(num[1])

for group in G:
    if x in group and y in group:
        print "Yes"
print "No"

Submission status: Wrong Answer

Solution code:
def rren(): return list(map(int, input().split()))
 
 
H, W = rren()
if(H % 3 == 0 or W % 3 == 0):
    print(0)
else:
    lis = []
    ans = 114514810
    for i in range(H-1):
      for j in range(10):
        a = H - i
        b = i
        c = abs(W // 2 + j)
        lis = [W*a, b*c, (W-c)*b]
        ans = min(ans, max(lis) - min(lis))
        lis.clear()
    for i in range(W-1):
      for j in range(10):
        a = W - i
        b = i
        c = abs(H // 2 + j)
        lis = [H*a, b*c, (H-c)*b]
        ans = min(ans, max(lis) - min(lis))
        lis.clear()
    for i in range(W//4, W//2):
        ans = min(ans, abs(i - (W-i*2))*H)
    for i in range(H//4, H//2):
        ans = min(ans, abs(i - (H-i*2))*W)
    print(ans)

Submission status: Wrong Answer

Solution code:
#AtCoder Beginner Contest 062 C - Chocolate Bar
H,W=[int(x) for x in input().split()]
if(H%3==0 or W%3==0):
    print(0)
if(H>W):
    min_dif=W
else:
    min_dif=H
    
if(H%2!=0):
    for i in range(W-1):
        A=(i+1)*H
        B=(W-(i+1))*int(H/2)
        C=H*W-A-B
        D=[A,B,C]
        D.sort()
        if(min_dif>abs(D[0]-D[2])):
            min_dif=abs(D[0]-D[2])
            
if(H%2==0):
    for i in range(W-1):
        A=(i+1)*H
        B=(W-(i+1))*int(H/2)
        if(min_dif>abs(A-B)):
            min_dif=abs(A-B)
            
if(W%2!=0):
    for i in range(H-1):
        A=W*(i+1)
        B=int(W/2)*(H-(i+1))
        C=H*W-A-B
        D=[A,B,C]
        D.sort()
        if(min_dif>abs(D[0]-D[2])):
            min_dif=abs(D[0]-D[2])
            
if(W%2==0):
    for i in range(H-1):
        A=W*(i+1) 
        B=int(W/2)*(H-(i+1))
        if(min_dif>abs(A-B)):
            min_dif=abs(A-B)
print(min_dif)

Submission status: Wrong Answer

Solution code:
import math
h, w = map(int, input().split())
low = min(h, w)
high = max(h, w)

if h%3 == 0 or w%3 == 0:
    print (0)
elif (high/3) > low:
    print(high - int(high/3))
else:
    a = math.ceil(high/3)*low
    b = (high-math.ceil(high/3))*int(low/2)
    c = abs(a-b)

    a = round(high/3)*low
    b = (high-round(high/3))*int(low/2)
    d = abs(a-b)

    print (min(c, d))

Submission status: Wrong Answer

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

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

#group check
if x in list1 and y in list1:
    print "YES"
elif x in list2 and y in list2:
    print "YES"
elif x in list3 and y in list3:
    print "YES"
else:
    print "NO"

Submission status: Wrong Answer

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

N = [int(i) for i in input().split()]

for i in range(2):
	a[i] = N[i] in listA
	b[i] = N[i] in listB
	c[i] = N[i] in listC


if a[0] == True and a[1] == True:
	print ("yes")
elif b[0] == True and b[1] == True:
	print ("yes")
elif c[0] == True and c[1] == True:
	print ("yes")
else:
	print ("no")

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
a = [i for i in range(1,13)]
b = [0,2,0,1,0,1,0,0,1,0,1,1]
c = dict(zip(a,b))
print('Yes' if c[x]==c[y] else 'No')

Submission status: Wrong Answer

Solution code:
data = input().split()
x = int(data[0])
y = int(data[1])

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

print(L1)
print(L2)
print(L3)

if((x in L1 and y in L1) or (x in L2 and y in L2) or (x in L3 and y in L3)):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
import sys

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

arg = raw_input()
x = int(arg.split(" ")[0])
y = int(arg.split(" ")[1])

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

Submission status: Wrong Answer

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

flag=0 
for ll in l:
    if x in ll and y in ll:
        print("Yes")
        flag=1
        break
if flag==0:
    print("No")

Submission status: Wrong Answer

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

if x == 2 :
  print ('NO')

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

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
x,y = map(int,raw_input().split(" "))

lista = [1,3,5,7,8,10,12]
listb = [4,6,9,11]

if(x in lista):
	if(y in lista):
		print "Yes"
	else:
		print "NO"

elif(x in listb):
	if(y in listb):
		print "Yes"
	else:
		print "NO"


else:
	print "NO"

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/bin/python3

import sys

G1 = [1, 3, 5, 7, 8, 10, 12]
G2 = [4, 6, 9, 11]

x,y = input().strip().split(' ')
x,y = [int(x),int(y)]

if x in G1 and y in G1:
    print("yes")
elif x in G2 and y in G2:
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x, y = map(int,input().split())
t1 = [1,3,5,7,8,12]
t2 = [4,6,9,11]
t3 = [2]

if x in t1 and y in t1:
    print("Yes")
elif x in t2 and y in t2:
    print("Yes")
elif x in t3 and y in t3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

x_check=[ x in ll for ll in l]
y_check=[ y in ll for ll in l]
if x_check==y_check:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

    if a == 2 or b == 2:
        print("No")
        return

    list = [4, 6, 9, 11]
    count = 0
    
    for x in list:
        if a == x or b == x:
            count += 1

    if count == 1:
        print("No")
        return
        
    print("Yes")


if __name__ == "__main__":
    iroha()

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())
A=set([1, 3, 5, 7, 8, 10, 12])
B=set([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())
S1 = [1, 3, 5, 7, 8, 10, 12]
S2 = [4, 6, 9, 11]
ans = False
for i in range(len(S1)):
  for j in range(len(S1)):
    if S1[i] == x and S1[j] == y:
      ans = True
for i in range(len(S2)):
  for j in range(len(S2)):
    if S2[i] == x and S2[j] == y:
      ans = True
if ans:
  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 == 2 or y == 2:
  print('No')
elif x in a and y in a:
  print('Yes')
elif x in b and y in b:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

xg = yg = ""
def group(x):
  if x in ga:
    return "ga"
  if x in gb:
    return "gb"
  if x in gc:
    return "gc"
xg = group(x)
yg = group(y)
if xg == yg:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

if (x in a and y in a) 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:
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) or (x in array2 and y in array2) or (x in array3 and y in array3):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

if x in s:
    if y in s:
        print('Yes')
        exit()
elif x in s1:
    if y in s1:
        print('Yes')
        exit()
elif x in s2:
    if y in s2:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lst = input().split()

x = int(lst[0])
y = int(lst[1])

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

def judge(L):
   if (x in L) and (y in L):
      return True
   else:
      return False

if judge(A) or judge(B) or judge(C):
   print('Yes')
else:
   print('No')

Submission status: Accepted

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

if x in gr_a and y in gr_a:
  print("Yes")
elif x in gr_b and y in gr_b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

group_1 = {1, 3, 5, 7, 8, 10, 12}
group_2 = {4, 6, 9, 11}

if (x in group_1) and (y in group_1):
    print('Yes')
elif (x in group_2) and (y in group_2):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if x in A and y in A:
  check = True
elif x in B and y in B:
  check = True
elif x in C and y in C:
  check = True
else:
  check = False
  
print("Yes" if check else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A - Grouping
def main():
    x, y = map(int, input().split())
    g_a = [1, 3 , 5, 7, 8, 10, 12]
    g_b = [4, 6, 9, 11]
    g_c = [2]

    if x in g_a and y in g_a:
        print('Yes')
    elif x in g_b and y in g_b:
        print('Yes')
    elif x in g_c and y in g_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,13}
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) or (x in B and y in B):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
data=[1,3,1,2,1,2,1,1,2,1,2,1]
if data[x-1]==data[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]
acount = 0
bcount = 0
ccount = 0

x, y = input().split()

for i in range(0, 7):
    if int(x) == a[i] or int(y) == a[i]:
        acount += 1

for i in range(0, 4):
    if int(x) == b[i] or int(y) == b[i]:
        bcount += 1

if int(x) == c[0]:
    ccount += 1
if int(y) == c[0]:
    ccount += 1


if acount == 2 or bcount == 2 or ccount == 2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    x, y = i_map()

    if x == 2 or y == 2:
        print('No')
        exit()

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if x in G1 and y in G1:
  print('Yes')
elif x in G2 and y in G2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
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:
def main():
    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 in [2] and y in [2]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

list_of_list = [group_a, group_b, group_c]

count_match = 0

for set_i in list_of_list:
    if set_i.issuperset(input_set):
        count_match += 1
        print('Yes')
        break

if not count_match >= 1:
    print('No')

Submission status: Accepted

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

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

count_match = 0

for list_i in list_of_list:
    if input_list[0] in list_i and input_list[1] in list_i:
        count_match += 1
        break

if count_match == 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]
p=0
q=0

s=list(map(int,input().split()))

for i in a:
  if s[0]==i:
    p=0
  elif s[0]==2:
    p=2
  else:
    p=1

for i in a:
  if s[1]==i:
    q=0
  elif s[1]==2:
    q=2
  else:
    q=1

if p==q:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    x, y = map(int, readline().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")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = [1,3,5,7,8,10,12]
b = [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())

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

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

Submission status: Accepted

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

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

if x in gr1 and y in gr1:
    print('Yes')
elif x in gr2 and y in gr2:
    print('Yes')
elif x in gr3 and y in gr3:
    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:
x, y = map(int, input().split())

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


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

Submission status: Accepted

Solution code:
G = [set([1,3,5,7,8,10,12]), set([4,6,9,11]), set([2])]
def check(x, y):
  for g in G:
    if x in g and y in g:
      return True
  return False
x, y = map(int, input().split())
print("Yes" if check(x, y) else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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