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
import os

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

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

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

Solution (Python):
input = input().split()
a = int(input[0])
b = int(input[1])

list = [1,3,1,2,1,2,1,1,2,1,2,1]

if list[a-1] == list[b-1]:
    print('Yes')
else:
    print('No')

Solution (Python):

x, y = [int(n) for n in input().split()]
group = [0, 1, 3, 1, 2, 1 , 2, 1, 1, 2, 1, 2, 1]
if group[x] == group[y]:
    print("Yes")
else:
    print("No")

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

if ((n in a) and (m in a)) or ((n in b) and (m 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 = [int(x) for x in input().split()]
if x in C or y in C:
    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):
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

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

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

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

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

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

X = 0
Y = 0
if L1.count(x) == 1:
	X = 1
elif L2.count(x) == 1:
	X = 2
else:
	X = 3

if L1.count(y) == 1:
	Y = 1
elif L2.count(y) == 1:
	Y = 2
else:
	Y = 3

if X == Y:
	print("Yes")
else:
	print("No")

Solution (Python):
g = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
a,b = map(int,raw_input().split(' '))
flag = False
for i in g:
    if (a in i) and (b in i):
        flag = True
        break
if flag:
    print "Yes"
else:
    print "No"

Solution (Python):
import sys

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

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

if x == 2 or y == 2:
    print("No")
    sys.exit(0)
else:
    for g in group:
        if x in g and y in g:
            print("Yes")
            sys.exit(0)
    print("No")

Solution (Python):



def read():
    return map(int, raw_input().split())


def work((a, b)):
    group = [[1, 3, 5, 7, 8, 10, 12],
             [4, 6, 9, 11],
             [2]]
    
    for vList in group:
        if a in vList and b in vList:
            print "Yes"
            return

    print "No"


if __name__ == "__main__":
    work(read())

Solution (Python):
a_group = [1, 3, 5, 7, 8, 10, 12]
b_group = [4, 6, 9, 11]
c_group = [2]

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

if x in a_group and y in a_group:
    print('Yes')
elif x in b_group and y in b_group:
    print('Yes')
elif x in c_group and y in c_group:
    print('Yes')
else:
    print('No')

Solution (Python):


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

x, y = raw_input().split()

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

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

Solution (Python):
x, y = map(int, raw_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 = [int(i) for i in raw_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, raw_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]
a1 = [4,6,9,11]
a2 = [2]
x , y = map(int ,raw_input().split())
if x in a and y in a:
	print 'Yes'
elif x in a1 and y in a1:
	print 'Yes'
elif x in a2 and y in a2:
	print 'Yes'
else:
	print 'No'