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

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) and (y==4 or y==6 or y==9 or y==11):
  print("Yes")
elif (x==4 or x==6 or x==9 or x==11) or (y==4 or y==6 or y==9 or y==11):
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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())
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]

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

Submission status: Accepted

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


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


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

print ('No')

Submission status: Accepted

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

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


if x==2 or y== 2:
    print('No')
elif x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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, l in enumerate(li):
    if x in l and y in l:
        print("Yes")
        break
    if i == len(li) - 1:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #a = r.split()
    a = list(map(int, r.split()))
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #res = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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]

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)

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:


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

Submission status: Accepted

Solution code:


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

Submission status: Accepted

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

Submission status: Accepted

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

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])
C = set([2])

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = " ACABABAABABA"
x, y = map(int, input().split())
print("Yes" if S[x] == S[y] else "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:
  print('Yes')
elif d in b and e in b:
  print('Yes')
else:print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 = [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:
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')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

group = [0]*13
group[2] = 1 # 1グループ
for i in (4,6,9,11): # 2グループ
  group[i] = 2
  
print("Yes" if group[x] == group[y] 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)
# (2) は合うことはない
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())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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):
  print('Yes')
elif (x in b)and(y in b):
  print('Yes')
elif x==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:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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):
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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