Problem:


Score : 100 points

Problem Statement

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

Constraints

x and y are integers.

1 ≤ x < y ≤ 12

Input

Input is given from Standard Input in the following format:

x y

Output

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

Sample Input 1

1 3

Sample Output 1

Yes

Sample Input 2

2 4

Sample Output 2

No



Sample input:
1 3


Sample output:
Yes

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(3):
    if x in g[i] and y in g[i]:
        print('Yes')
        exit()
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())
l=[1,3,5,7,8,10,12]
if a==2 or b==2:print("No")
elif int(a in l)==int(b in l):print("Yes")
else:print("No")

Submission status: Accepted

Solution code:
s=[0,0,2,0,1,0,1,0,0,1,0,1,0];a,b=map(int,input().split());print("Yes"if s[a]==s[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]
if x==2 or y==2:
    print("No")
else:
    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:
print("YNeos"[input().count('2')::2])

Submission status: Accepted

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

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

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=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:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def main():
    x, y = li_input()
    p1, p2 = [1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11]

    if x in p1:
        xg = 1
    elif x in p2:
        xg = 2
    else:
        xg = 3

    if y in p1:
        yg = 1
    elif y in p2:
        yg = 2
    else:
        yg = 3

    if xg == yg:
        print("Yes")
    else:
        print("No")


main()

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:
# -*- coding: utf-8 -*-

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if input().count("2")>0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

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

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

Submission status: Accepted

Solution code:
x,y = (int(_) for _ in input().split())

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

if (x in s1 and y in s1) or \
        (x in s2 and y in s2) or \
        (x in s3 and y in s3):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=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")

Submission status: Accepted

Solution code:
#62a
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) or (x in g2 and y in g2) :
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]
x, y = list(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 in g3 and y in g3:
    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())
for i in [a, b, c]:
  if x in i and y in i:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

def main():
    a = [1, 3, 5, 7, 8, 10, 12]
    b = [4, 6, 9, 11]
    c = [2]

    x, y = map(int, input().split())
    
    if all(i in a for i in [x, y]) or all(i in b for i in [x, y]) or all(i in c for i in [x, y]):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

if (a in g1 and b in g1) or (a in g2 and b in g2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a={1,3,5,7,8,10,12}
b={4,6,9,11}
c={2}
d,e=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")

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 == y:
    print("Yes")
elif a.count(x) > 0 and a.count(y) > 0:
    print("Yes")
elif b.count(x) > 0 and b.count(y) > 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def judge(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
x, y = map(int, input().split())
if judge(x) == judge(y):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

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

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

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

Submission status: Accepted

Solution code:
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:
    if y == 4 or y == 6 or y == 9 or y == 11:
        print('Yes')
    else:
        print('No')
elif x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12:
    if x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 in G3 and y in G3:
    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")      
elif x in c and y in c:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
import sys

groups = {
    (1, 3, 5, 7, 8, 10, 12),
    (4, 6, 9, 11),
    (2, )
}

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

for group in groups:
    if x in group and y in group:
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

Solution code:
groups = {(1, 3, 5, 7, 8, 10, 12), (4, 6, 9, 11), (2,)}

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

print("Yes" if any([(x in group) and (y in group) for group in groups]) else "No")

Submission status: Accepted

Solution code:
group_a = [1,3,5,7,8,10,12]
group_b = [4,6,9,11]
group_c = [2]
judge = 0
num,num_2 = map(int,input().split())
for n in [group_a,group_b,group_c]:
    if num in n and num_2 in n:
        judge += 1

if judge >= 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]
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:
#coding:utf-8
n=[int(i) for i in input().split()]
m1=[1,3,5,7,8,10,12]
m2=[4,6,9,11]
if(n[0]==n[1]==2):
  print("Yes")
elif(n[0] in m1 and n[1] in m1):
  print("Yes")
elif(n[0] in m2 and n[1] in m2):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

n,m=map(int,input().split())

if n in a and m in a:
  print("Yes")
elif n in b and m in b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
l = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]
assert len(l) == 13
x, y = (int(z) for z in raw_input().split())
print "Yes" if l[x] == l[y] else "No"

Submission status: Accepted

Solution code:
from itertools import repeat, chain

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

xs,ys,zs = (1,3,5,7,8,10,12), (4,6,9,11), (2,)
d = dict(chain(zip(xs, repeat(0)), zip(ys, repeat(1)), zip(zs, repeat(2))))

print('Yes' if d[a] == d[b] else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

for i in d:
    if x in i and y in i:
        print("Yes")
        exit()
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:
g_1 = [1,3,5,7,8,10,12]
g_2 = [4,6,9,11]
g_3 = [2]
x,y = map(int,input().split())
if x in g_1 and y in g_1:
    print("Yes")
elif x in g_2 and y in g_2:
    print("Yes")
elif x in g_3 and y in g_3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

if x[0] in a and x[1] in a:
	print("Yes")
elif x[0] in b and x[1] in b:
	print("Yes")
elif x[0] == 2 and x[1] == 2:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
x = [1,3,5,6,7,8,10,12]
y = [4,6,9,11]
z = [2]
a,b = list(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")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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 or x in grp2 and y in grp2 or x in grp3 and y in grp3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

group_1 = set([1, 3, 5, 7, 8, 10, 12])
group_2 = set([4, 6, 9, 11])
group_3 = set([2])

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 = 2

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

def ck(x,y):
  if x in a and y in a:
    yes()
  elif x in b and y in b:
    yes()
  elif x == c and y == c:
    yes()
  else:
    no()
    
def yes():
  print("Yes")

def no():
  print("No")
  
ck(x,y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=map(int,raw_input().split())
d=[0,1,-1,1,0,1,0,1,1,0,1,0,1]
if d[x] == d[y]:
  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]

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:
a=[1,3,1,2,1,2,1,1,2,1,2,1]
x,y=map(int,input().split())
print(["No","Yes"][a[x-1]==a[y-1]])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = (int(i) for i in 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) or (x in list2 and y in list2) or (x in list3 and y in list3):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
# coding: utf-8
x,y = map(int,input().split())
li = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
for i in li:
    if x  in i and y in i:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
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')

Submission status: Accepted

Solution code:
import sys

x, y = list(map(int, input().split()))
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [2]
group3 = [4, 6, 9, 11]

if group1.count(x) > 0 and group1.count(y) > 0:
  print("Yes")
  sys.exit()

if group2.count(x) > 0 and group2.count(y) > 0:
  print("Yes")
  sys.exit()

if group3.count(x) > 0 and group3.count(y) > 0:
  print("Yes")
  sys.exit()

print("No")

Submission status: Accepted

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

if a in l and b in l:
  print('Yes')
elif a in m and b in m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
def grp(x):
  if x=="2":
    return "a"
  elif x in ("4","6","9","11"):
    return "b"
  else:
    return "c"
x,y=list(map(grp,input().split()))
print("Yes" if x==y else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = [int(i) for i in input().split(' ')]

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

ax = list(map(lambda i: x in i, g))
ay = list(map(lambda i: y in i, g))
print('Yes' if ax == ay else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
parent = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().split())
print(["No","Yes"][parent[x]==parent[y]])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b=[int(i) for i in input().split()]

one=[1,3,5,7,8,10,12]
two=[4,6,9,1]
three=[2]

if a in one and b in one:
    print("Yes")
elif a in two and b in two:
    print("Yes")
elif a in three and b in three:
    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 B) or (x in B and y in A):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
x, y = map(int, input().split(' '))
groupA = set([1,3,5,7,8,10,12])
groupB = set([4,6,9,11])
groupC = set([2])
if set([x, y]) <= groupA or set([x, y]) <= groupB:
    print('Yes')
else: print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
list_1=[1,3,5,7,8,10,12]
list_2=[4,6,9,11]
list_3=[2]
if list_1.count(X)==list_1.count(Y)==1 or list_2.count(X)==list_2.count(Y)==1:
    print ('Yes')
else:
    print ('No')

Submission status: Accepted

Solution code:
group = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
def judge(a, b):
	for i in range(0, len(group)):
		if a in group[i]:
			if b in group[i]: return 'Yes'
			else: return 'No'

x, y = map(int, raw_input().split())
print judge(x, y)

Submission status: Accepted

Solution code:
inx,iny = map(int,input().split())
if inx in [4,6,9,11]:
  gx = 2
elif inx == 2:
  gx = 3
else:
  gx = 1
if iny in [4,6,9,11]:
  gy = 2
elif iny == 2:
  gy = 3
else:
  gy = 1
  
if gx == gy:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

yes=False
for i in group:
    if N[0] in i and N[1] in i:
        print("Yes")
        yes=True
        
if not yes:print("No")

Submission status: Accepted

Solution code:
a, b = list(map(int,input().split()))
i = [1,3,5,7,8,9,10,12]
j = [4,6,9,11]
k = i.count(a)
l = i.count(b)
m = j.count(a)
n = j.count(b)
if k+l ==2 or m+n == 2:
    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())
print('Yes' if g[x]==g[y] else 'No')

Submission status: Accepted

Solution code:
a = [0,2,0,1,0,1,0,0,1,0,1,0]
x, y = map(int, input().split())

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

Submission status: Accepted

Solution code:
def same(x, y):
    for g in [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]:
        if x in g and y in g:
            return 'Yes'
    return 'No'


if __name__ == '__main__':
    x, y = map(int, input().split())
    print(same(x, y))

Submission status: Accepted

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

Submission status: Accepted

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

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

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())
s = [4, 6, 9, 11]
if x in s and y in s: print('Yes')
elif x in s or y in s: print('No')
elif x == 2 or y == 2: print('No')
else: print('Yes')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
num1 = [1, 3, 5, 7, 8, 10, 12]
num2 = [4, 6, 9, 11]
if x in num1 and y in num1 or x in num2 and y in num2:
	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:
group_1 = [1, 3, 5, 7, 8, 10, 12]
group_2 = [4, 6, 9, 11]

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

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:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

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

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


if (x in arr01 and y in arr01) or (x in arr02 and y in arr02):
    
    print("Yes")
    
else:
    
    
    print("No")

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem A

if __name__ == '__main__':
    x, y = map(int, input().split())

    groupA = [1, 3, 5, 7, 8, 10, 12]
    groupB = [4, 6, 9, 11]
    groupC = [2]

    condition1 = (x in groupA) and (y in groupA)
    condition2 = (x in groupB) and (y in groupB)
    condition3 = (x in groupC) and (y in groupC)

    if condition1 or condition2 or condition3:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

ok = False
if x in A and y in A:
    ok = True
elif x in B and y in B:
    ok = True

print('Yes' if ok 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 == 2 or y == 2:
    print('No')
elif (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:
s=[0,2,0,1,0,1,0,0,1,0,1,0]
a,b=map(int,input().split())
if s[a-1]==s[b-1]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

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

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:
ans=[4,6,9,11]
a,b=map(int,input().split())

def solve(x,y):
  if x==2 or y==2:
    return False
  elif (x in ans and y in ans) or (not(x in ans) and not(y in ans)):
    return True
  else:
    return False

if solve(a,b):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=[int(i)for i in input().split()];f=lambda x,l:not(set(x)-set(l));print(["No","Yes"][f(s,[1,3,5,7,8,10,12])or f(s,[4,6,9,11])or f(s,[2])])

Submission status: Accepted

Solution code:
s=[int(i)for i in input().split()];f=lambda x,l:not(set(x[:])-set(l));print(["No","Yes"][f(s,[1,3,5,7,8,10,12])or f(s,[4,6,9,11])or f(s,[2])])

Submission status: Accepted

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

x, y = map(int, input().split())
x_i = y_i = -1
for (i, g) in enumerate(gs):
    for num in g:
        if num == x:
            x_i = i
for (i, g) in enumerate(gs):
    for num in g:
        if num == y:
            y_i = i
if x_i == y_i:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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