Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Dice III

  Write a program which reads the two dices constructed in the same way as Dice I, and determines whether these two dices are identical. You can roll a dice in the same way as Dice I, and if all integers observed from the six directions are the same as that of another dice, these dices can be considered as identical.

Input

  In the first line, six integers assigned to faces of a dice are given in ascending order of their corresponding labels.

    In the second line, six integers assigned to faces of another dice are given in ascending order of their corresponding labels.

Output

  Print "Yes" if two dices are identical, otherwise "No" in a line.

Constraints

$0 \leq $ the integer assigned to a face $ \leq 100$

Sample Input 1

1 2 3 4 5 6
6 2 4 3 5 1

Sample Output 1

Yes

Sample Input 2

1 2 3 4 5 6
6 5 4 3 2 1

Sample Output 2

No



Sample input:
1 2 3 4 5 6
6 2 4 3 5 1


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.dice=[1,2,3,4,5,6] # up,front,right,left,back,front
    def set(self,l):
        self.dice=l
    def roll(self, s):
        import copy
        mat=((1,4,3,2),(5,0,1,1),(2,2,0,5),(3,3,5,0),(0,5,4,4),(4,1,2,3))
        l=copy.deepcopy(self.dice)
        if s == 'N': c = 0
        if s == 'S': c = 1
        if s == 'E': c = 2
        if s == 'W': c = 3
        for i in range(6):
            self.dice[i]=l[mat[i][c]]
    def get(self):
        return self.dice

import random
d1=Dice()
d2=Dice()
d1.set(list(map(int,input().split())))
d2.set(list(map(int,input().split())))

f=False
for _ in range(4):
    d2.roll('N')
    for _ in range(4):
        d2.roll('W')
        f = f or (d1.get() == d2.get())
print('Yes' if f else 'No')

Submission status: Wrong Answer

Solution code:
class Dice(object):
    
    def __init__(self, line):
        self.top = 1
        self.bottom = 6
        self.south = 2
        self.east = 3
        self.west = 4
        self.north = 5
        self.convert = [int(s) for s in line.split()]
    
    def move(self, direction):
        if 'N' == direction:
            self.top, self.north, self.bottom, self.south = self.south, self.top, self.north, self.bottom
        elif 'S' == direction:
            self.top, self.north, self.bottom, self.south = self.north, self.bottom, self.south, self.top
        elif 'W' == direction:
            self.top, self.east, self.bottom, self.west = self.east, self.bottom, self.west, self.top
        elif 'E' == direction:
            self.top, self.east, self.bottom, self.west = self.west, self.top, self.east, self.bottom
    
    def rv(self, key):
        index_list = {
            'top' : self.top,
            'bottom' : self.bottom,
            'south' : self.south,
            'east' : self.east,
            'west' : self.west,
            'notrh' : self.north
        }
        return self.convert[index_list[key] - 1]
    
    def search(self, dice):
        
        for direction in 'NNNNWNNNN':
            self.move(direction)
            if self.rv('south') == dice.rv('south'):
                break
        
        if self.rv('south') != dice.rv('south') or self.rv('notrh') != dice.rv('notrh'):
            return 'No'            
        
        for direction in 'WWWW':
            self.move(direction)
            if self.rv('top') == dice.rv('top'):
                break
        
        if self.rv('top') != dice.rv('top'):
            return 'No'
        if self.rv('bottom') != dice.rv('bottom'):
            return 'No'
        if self.rv('east') != dice.rv('east'):
            return 'No'
        if self.rv('notrh') != dice.rv('notrh'):
            return 'No'
        
        return 'Yes'
    
dice = Dice('1 2 3 4 5 6')
dice2 = Dice('6 5 4 3 2 1')
print(dice.search(dice2))

Submission status: Wrong Answer

Solution code:
class Dice:
    dice = {'N':2, 'E':4, 'S':5, 'W':3}
    faces = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6}
    currTop = 1

    def __init__(self, faces = None):
        if faces is not None:
            self.faces = faces

    def top(self):
        return self.currTop

    def topFace(self):
        return self.faces[self.currTop]

    def rot(self, direction):
        newTop = self.dice[direction]
        currTop = self.currTop
        self.currTop = newTop
        if direction == 'N':
            self.dice['N'] = 7 - currTop
            self.dice['S'] = currTop
        elif direction == 'S':
            self.dice['N'] = currTop
            self.dice['S'] = 7 - currTop
        elif direction == 'E':
            self.dice['E'] = 7 - currTop
            self.dice['W'] = currTop
        elif direction == 'W':
            self.dice['E'] = currTop
            self.dice['W'] = 7 - currTop

    def yaw(self, direction):
        newDice = {}
        if direction == 'E':
            newDice['N'] = self.dice['E']
            newDice['E'] = self.dice['S']
            newDice['S'] = self.dice['W']
            newDice['W'] = self.dice['N']
        if direction == 'W':
            newDice['N'] = self.dice['W']
            newDice['E'] = self.dice['N']
            newDice['S'] = self.dice['E']
            newDice['W'] = self.dice['S']
        self.dice = newDice

faces1 = {k:v for k,v in zip(range(1,7), map(int, input().split()))}
faces2 = {k:v for k,v in zip(range(1,7), map(int, input().split()))}

d1 = Dice(faces1)
d2 = Dice(faces2)

if d1.topFace() != d2.topFace():
    # search d1.topFace() in d2 and rotate to make d2.topFace() equal to d1.topFace().
    key = [k for k,v in d2.dice.items() if d1.topFace() == d2.faces[v]]
    if len(key) == 0:
        d2.rot('N')
        key = [k for k,v in d2.dice.items() if d1.topFace() == d2.faces[v]]
    d2.rot(key[0])

if d1.topFace() != d2.topFace():
    print('No')
    exit()

while True:
    cnt = 0
    if cnt > 4 or d1.faces[d1.dice['N']] == d2.faces[d2.dice['N']]:
        break
    d2.yaw('E')
    cnt += 1

d2State = {k:d2.faces[v] for k,v in d2.dice.items()}
for d1k,d1f in {k:d1.faces[v] for k,v in d1.dice.items()}.items():
    if d1f != d2State[d1k]:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, faces = None):
        self.dice = {'N':2, 'E':4, 'S':5, 'W':3}
        self.faces = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6}
        self.currTop = 1
        if faces is not None:
            self.faces = faces

    def top(self):
        return self.currTop

    def topFace(self):
        return self.faces[self.currTop]

    def rot(self, direction):
        newTop = self.dice[direction]
        currTop = self.currTop
        self.currTop = newTop
        if direction == 'N':
            self.dice['N'] = 7 - currTop
            self.dice['S'] = currTop
        elif direction == 'S':
            self.dice['N'] = currTop
            self.dice['S'] = 7 - currTop
        elif direction == 'E':
            self.dice['E'] = 7 - currTop
            self.dice['W'] = currTop
        elif direction == 'W':
            self.dice['E'] = currTop
            self.dice['W'] = 7 - currTop

    def yaw(self, direction):
        newDice = {}
        if direction == 'E':
            newDice['N'] = self.dice['E']
            newDice['E'] = self.dice['S']
            newDice['S'] = self.dice['W']
            newDice['W'] = self.dice['N']
        if direction == 'W':
            newDice['N'] = self.dice['W']
            newDice['E'] = self.dice['N']
            newDice['S'] = self.dice['E']
            newDice['W'] = self.dice['S']
        self.dice = newDice

faces1 = {k:v for k,v in zip(range(1,7), map(int, input().split()))}
faces2 = {k:v for k,v in zip(range(1,7), map(int, input().split()))}

d1 = Dice(faces1)
d2 = Dice(faces2)

if d1.topFace() != d2.topFace():
    # search d1.topFace() in d2 and rotate to make d2.topFace() equal to d1.topFace().
    key = [k for k,v in d2.dice.items() if d1.topFace() == d2.faces[v]]
    if len(key) == 0:
        d2.rot('N')
        key = [k for k,v in d2.dice.items() if d1.topFace() == d2.faces[v]]
    d2.rot(key[0])

if d1.topFace() != d2.topFace():
    print('No')
    exit()

# rotate(yaw) to make frontIdx front.
while True:
    cnt = 0
    if cnt > 4 or d1.faces[d1.dice['N']] == d2.faces[d2.dice['N']]:
        break
    d2.yaw('E')
    cnt += 1

# compare two dices.
d2State = {k:d2.faces[v] for k,v in d2.dice.items()}
for d1k,d1f in {k:d1.faces[v] for k,v in d1.dice.items()}.items():
    if d1f != d2State[d1k]:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, faces = None):
        self.dice = {'N':2, 'E':4, 'S':5, 'W':3}
        self.faces = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6}
        self.currTop = 1
        if faces is not None:
            self.faces = faces

    def top(self):
        return self.currTop

    def topFace(self):
        return self.faces[self.currTop]

    def bottom(self):
        return 7 - self.currTop

    def bottomFace(self):
        return self.faces[self.bottom()]

    def rot(self, direction):
        newTop = self.dice[direction]
        currTop = self.currTop
        self.currTop = newTop
        if direction == 'N':
            self.dice['N'] = 7 - currTop
            self.dice['S'] = currTop
        elif direction == 'S':
            self.dice['N'] = currTop
            self.dice['S'] = 7 - currTop
        elif direction == 'E':
            self.dice['E'] = 7 - currTop
            self.dice['W'] = currTop
        elif direction == 'W':
            self.dice['E'] = currTop
            self.dice['W'] = 7 - currTop

    def yaw(self, direction):
        newDice = {}
        if direction == 'E':
            newDice['N'] = self.dice['E']
            newDice['E'] = self.dice['S']
            newDice['S'] = self.dice['W']
            newDice['W'] = self.dice['N']
        if direction == 'W':
            newDice['N'] = self.dice['W']
            newDice['E'] = self.dice['N']
            newDice['S'] = self.dice['E']
            newDice['W'] = self.dice['S']
        self.dice = newDice

faces1 = {k:v for k,v in zip(range(1,7), map(int, input().split()))}
faces2 = {k:v for k,v in zip(range(1,7), map(int, input().split()))}

d1 = Dice(faces1)
d2 = Dice(faces2)

if d1.topFace() != d2.topFace():
    # search d1.topFace() in d2 and rotate to make d2.topFace() equal to d1.topFace().
    key = [k for k,v in d2.dice.items() if d1.topFace() == d2.faces[v]]
    if len(key) == 0:
        d2.rot('N')
        key = [k for k,v in d2.dice.items() if d1.topFace() == d2.faces[v]]
    d2.rot(key[0])

if d1.topFace() != d2.topFace() or d1.bottomFace() != d2.bottomFace():
    print('No')
    exit()

# rotate(yaw) to make frontIdx front.
while True:
    cnt = 0
    if cnt > 4 or d1.faces[d1.dice['N']] == d2.faces[d2.dice['N']]:
        break
    d2.yaw('E')
    cnt += 1

# compare two dices.
d2State = {k:d2.faces[v] for k,v in d2.dice.items()}
for d1k,d1f in {k:d1.faces[v] for k,v in d1.dice.items()}.items():
    if d1f != d2State[d1k]:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
dice = [
	[1, 2, 4, 3, 5],
	[5, 2, 0, 3, 4],
	[1, 5, 4, 0, 3],
	[1, 0, 4, 5, 2],
	[0, 2, 5, 3, 1],
	[1, 3, 4, 2, 0]
]

def getRound(D, top):
	result = []
	for index in dice[top]:
		result.append(D[index])
	return result

def compare(D1, D2):
	i1 = 0
	if D1[0] not in D2:
		return False
	i2 = D2.index(D1[0])
	return getRound(D1, i1) == getRound(D2, i2)

D1 = input().split(" ")
D2 = input().split(" ")
if compare(D1, D2):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
dice = [
	[1, 2, 4, 3, 5],
	[5, 2, 0, 3, 4],
	[1, 5, 4, 0, 3],
	[1, 0, 4, 5, 2],
	[0, 2, 5, 3, 1],
	[1, 3, 4, 2, 0]
]

def getRound(D, top):
	result = []
	for index in dice[top]:
		result.append(D[index])
	return result

def compareRound(l1, l2):
	if l1[4] != l2[4]:
		return False
	elif l1[0] not in l2:
		return False
	offset = l2.index(l1[0])
	
	for i in range(4):
		if l1[i] != l2[(i+offset)%4]:
			return False
	return True

def compare(D1, D2):
	i1 = 0
	if D1[0] not in D2:
		return False
	i2 = D2.index(D1[0])
	return compareRound(getRound(D1, i1), getRound(D2, i2))

D1 = input().split(" ")
D2 = input().split(" ")
if compare(D1, D2):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split())) for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
print(('No','Yes')[''.join([str(e[i]) for i in range(1,5)]) in ''.join([str(d[int(i)]) for i in m])*2])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
print(('No','Yes')[''.join(f)in''.join(g)*2])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
print(('No','Yes')[7==d[0]+e[0]and''.join(f)in''.join(g)*2])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
print(('No','Yes')[d[5-d.index(e[0])]==e[5]and''.join(f)in''.join(g)*2])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
d[3],d[4]=d[4],d[3]
e[3],e[4]=e[4],e[3]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
#f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
#g[2],g[3]=g[3],g[2]
g+=g
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
print(f,g)
for i in range(4):
 if f[i] in g:
  if g[g.index(f[i])+1]!=f[i+1]:print('No');break
  elif i==3:print('Yes')
 else:print('No');break

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
for i in range(4):
 if f[i] in g:
  if g[g.index(f[i])+1]!=f[i+1]:print('No');break
  elif i==3:print('Yes')
 else:print('No');break

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
if d[5-d.index(e[0])]==e[5]:
 for i in range(4):
  if g[g.index(f[i])+1]!=f[i+1]:print('No');break
  elif i==3:print('Yes')
else:print('No');

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
if d[5-d.index(e[0])]==e[5]:
 m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
 f=[str(e[i])for i in range(1,5)]+[str(e[1])]
 f[2],f[3]=f[3],f[2]
 g=[str(d[int(i)])for i in m]
 g[2],g[3]=g[3],g[2]
 g+=g
 for i in range(4):
  if g[g.index(f[i])+1]!=f[i+1]:print('No');break
  elif i==3:print('Yes')
else:print('No');

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
t=0
if d[5-d.index(e[0])]==e[5]:
 for i in range(4):
  if g[g.index(f[i])+1]!=f[i+1]:break
  elif i==3:t=1
print(('No','Yes')[t==1])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
t=0
if d[5-d.index(e[0])]==e[5]:
 for i in range(4):
  if g[g.index(f[i])+1]!=f[i+1]:break
  elif i==3:t+=1
print(('No','Yes')[t==1])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
t=0
if d[5-d.index(e[0])]==e[5]:
 for i in range(4):
  for j in range(4):
   if f[j]!=g[i+j]:break
   else: t+=1
  if t==4:break
  else:t=0
print(('No','Yes')[t==4])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
e[3],e[4]=e[4],e[3]
t=0
for i in range(6):
 m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}[i]
 f=[d[int(j)]for j in m];f[3],f[4]=f[4],f[3];f+=f
 if f[0]==e[0]:
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1;break
print(('No','Yes')[t==1])

Submission status: Wrong Answer

Solution code:
dice = list(map(int, input().split()))
dice2 = list(map(int, input().split()))
mask = {
    'N': (1, 5, 2, 3, 0, 4),
    'R': (0, 2, 4, 1, 3, 5)
    }

a, b = dice2[0], dice2[1]

find = True
lim = 0

n_cmp_flg = False
while dice[0] != a:
    dice = [dice[x] for x in mask['N']]
    lim += 1
    if lim == 4:
        if n_cmp_flg:
            find = False
            break
        else:
            n_cmp_flg = True
            dice = [dice[x] for x in mask['R']]
            lim = 0
lim = 0
while dice[1] != b:
    dice = [dice[x] for x in mask['R']]
    lim += 1
    if lim == 4:
        find = False
        break

if find:
    if dice == dice2:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
class dice:
    def __init__(self, li = [0] * 6):
        self.men = [0] + li
    def move0(self, a, b, c, d):
        self.men[a], self.men[b], self.men[c], self.men[d] = self.men[b], self.men[c], self.men[d], self.men[a]
    def move(self, h):
        if h == "N":
            self.move0(1, 2, 6, 5)
        elif h == "S":
            self.move0(1, 5, 6, 2)
        elif h == "W":
            self.move0(1, 3, 6, 4)
        elif h == "E":
            self.move0(1, 4, 6, 3)
        elif h == "O":
            self.men[1], self.men[6], self.men[2], self.men[5] = self.men[6], self.men[1], self.men[5], self.men[2]
        elif h == "L":
            self.move0(2, 3, 5, 4)
        elif h == "R":
            self.move0(2, 4, 5, 3)
        elif h == "B":
            self.men[3], self.men[4], self.men[2], self.men[5] = self.men[4], self.men[3], self.men[5], self.men[2]
    def move2(self, a, b):
        if self.men[1] != a:
            for i, s in [(2, "N"), (3, "W"), (4, "E"), (5, "S"), (6, "O")]:
                if self.men[i] == a:
                    self.move(s)
                    break
        if self.men[2] != b:
            if b == self.men[3]:
                self.move("L")
            elif b == self.men[4]:
                self.move("R")
            else:
                self.move("B")
saikoro1 = dice(list(map(int, input().split())))
saikoro2 = dice(list(map(int, input().split())))
try:
    top = saikoro2.men[saikoro2.men.index(saikoro1.men[1])]
    front = saikoro2.men[saikoro2.men.index(saikoro1.men[2])]
    saikoro2.move2(top, front)
    print("Yes" if saikoro1.men == saikoro2.men else "No")
except:
    print("No")

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
t=0
if d[5-d.index(e[0])]==e[5]:
 for i in range(4):
  if g[g.index(f[i])+1]!=f[i+1]:break
  elif i==3:t+=1
print(('No','Yes')[t==1])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
print(('No','Yes')[''.join(f)in''.join(g)*2])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
t=0
m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}
for i in range(6):
 f=[d[int(j)]for j in m[i]];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:
    print('No');break
  else:print('Yes')

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
t=0
m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}
for i in range(6):
 f=[d[int(j)]for j in m[i]];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:
    print('Yes');break
  else:print('No')

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}
for i in range(6):
 f=[d[int(j)]for j in m[i]];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:print('No');break
   elif i==3:print('Yes')

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}
for i in range(6):
 f=[d[int(j)]for j in m[i]];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:
    print('No');break
   elif i==3:print('Yes')

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}
for i in range(6):
 f=[d[int(j)]for j in m[i]];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:print('Yes');break
   elif i==3:print('No')

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}
for i in range(6):
 f=[d[int(j)]for j in m[i]];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:print('Yes');break
  else:print('No')

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
t=0
m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}
for i in range(6):
 f=[d[int(j)]for j in m[i]];f[3],f[4]=f[4],f[3]
 f=f[1:5]*2
 for j in range(4):
  if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t==1])

Submission status: Wrong Answer

Solution code:
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}
for i in range(6):
 f=[d[int(j)]for j in m[i]];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:print('Yes');break
  else:print('No');break

Submission status: Wrong Answer

Solution code:
import random

class Dice:
    def __init__(self, hoge):
        self.num = hoge
        self.face = {'U': 0, 'W': 3, 'E': 2, 'N': 4, 'S': 1, 'B': 5} 
    
    def move(self, direct):
        previouse = {k: v for k, v in self.face.items()}
        if direct == 'E':
            self.face['U'] = previouse['W']
            self.face['W'] = previouse['B']
            self.face['E'] = previouse['U']
            self.face['B'] = previouse['E']
        elif direct == 'W':
            self.face['U'] = previouse['E']
            self.face['W'] = previouse['U']
            self.face['E'] = previouse['B']
            self.face['B'] = previouse['W']
        elif direct == 'N':
            self.face['U'] = previouse['S']
            self.face['N'] = previouse['U']
            self.face['S'] = previouse['B']
            self.face['B'] = previouse['N']
        elif direct == 'S':
            self.face['U'] = previouse['N']
            self.face['N'] = previouse['B']
            self.face['S'] = previouse['U']
            self.face['B'] = previouse['S']
    
    def get_num(self, place):
        return self.num[self.face[place]]
    
    def getFace(self):
        for k, v in sorted(self.face.items()):
            yield self.num[v]
    
        
if __name__ == '__main__':
    dice1 = Dice([int(x) for x in input().split()])
    dice2 = Dice([int(x) for x in input().split()])
    d = ['E', 'W', 'N', 'S']
    for k in range(1000):
        c = 0
        rand_num1 = random.randint(0, 3)
        rand_num2 = random.randint(0, 3)
        dice1.move(d[rand_num1])
        dice2.move(d[rand_num2])
        for v1, v2 in zip(dice1.getFace(), dice2.getFace()):
            if v1 == v2:
                c += 1
        if c == 6:
            print ('Yes')
            break
        if k == 999:
            print ('No')

Submission status: Wrong Answer

Solution code:
import random
class Dice:
    def __init__(self, top, dside, rside, lside, uside, bottom):
        self.top = top
        self.dside = dside
        self.rside = rside
        self.lside = lside
        self.uside = uside
        self.bottom = bottom
    def north(self):
        (self.top, self.dside, self.bottom, self.uside) = (self.dside, 
            self.bottom, self.uside, self.top)
    def east(self):
        (self.top, self.lside, self.bottom, self.rside) = (self.lside,
            self.bottom, self.rside, self.top)
    def south(self):
        (self.top, self.dside, self.bottom, self.uside) = (self.uside, 
            self.top, self.dside, self.bottom)

num1 = list(map(int, input().split()))
num2 = list(map(int, input().split()))
dice1 = Dice(num1[0], num1[1], num1[2], num1[3], num1[4], num1[5])
dice2 = Dice(num2[0], num2[1], num2[2], num2[3], num2[4], num2[5])

while dice1.top!=dice2.top or dice1.rside!=dice2.rside:
    mode = random.randint(0, 2)
    if mode==0: 
        dice2.north()
    elif mode==1: 
        dice2.east()
    else: 
        dice2.south()
if dice1.bottom==dice2.bottom and dice1.lside==dice2.lside:
    if dice1.dside==dice2.dside: 
        print("Yes")
    else: 
        print("No")
else:
    print("No")

Submission status: Wrong Answer

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

import sys

face1 = sys.stdin.readline().split()
face2 = sys.stdin.readline().split()

right = [[None for front in range(6)] for top in range(6)]

# Top:1 Face:2 -> Right:3, Top:2 Face:6 -> Right:3 ...
right[0][1] = right[1][5] = right[5][4] = right[4][0] = 3 - 1
right[1][0] = right[5][1] = right[4][5] = right[0][4] = 4 - 1
right[0][2] = right[2][5] = right[5][3] = right[3][0] = 5 - 1
right[2][0] = right[5][2] = right[3][5] = right[0][3] = 2 - 1
right[3][1] = right[1][2] = right[2][4] = right[4][3] = 1 - 1
right[1][3] = right[2][1] = right[4][2] = right[3][4] = 6 - 1


f1_top = face1[0]
f1_front = face1[1]
f1_right = face1[2]

r_index = right[face2.index(f1_top)][face2.index(f1_front)]
if face2[r_index] == f1_right:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, dice):
        self.dice = dice
        self.buff = [n for n in dice]
    def east(self):
        self.dice[0] = self.buff[3]
        self.dice[2] = self.buff[0]
        self.dice[5] = self.buff[2]
        self.dice[3] = self.buff[5]
        self.buff = [n for n in self.dice]
    def west(self):
        self.dice[0] = self.buff[2]
        self.dice[2] = self.buff[5]
        self.dice[5] = self.buff[3]
        self.dice[3] = self.buff[0]
        self.buff = [n for n in self.dice]
    def north(self):
        self.dice[0] = self.buff[1]
        self.dice[1] = self.buff[5]
        self.dice[5] = self.buff[4]
        self.dice[4] = self.buff[0]
        self.buff = [n for n in self.dice]
    def south(self):
        self.dice[0] = self.buff[4]
        self.dice[1] = self.buff[0]
        self.dice[5] = self.buff[1]
        self.dice[4] = self.buff[5]
        self.buff = [n for n in self.dice]
    def isSameDice(self, anotherDice):
        if \
        self.dice[0] == anotherDice.dice[0] and \
        self.dice[1] == anotherDice.dice[1] and \
        self.dice[2] == anotherDice.dice[2] and \
        self.dice[3] == anotherDice.dice[3] and \
        self.dice[4] == anotherDice.dice[4] and \
        self.dice[5] == anotherDice.dice[5]:
            return True
        return False


nums1 = list(map(int, input().split()))
nums2 = list(map(int, input().split()))
dice1 = Dice(nums1)
dice2 = Dice(nums2)
buff = Dice(nums2)

flag = False
if (dice1.dice[0] in dice2.dice) and \
   (dice1.dice[1] in dice2.dice) and \
   (dice1.dice[2] in dice2.dice):
    i = dice2.dice.index(dice1.dice[0])
    j = dice2.dice.index(dice1.dice[1])
    k = dice2.dice.index(dice1.dice[2])
    if dice1.dice[5] == dice2.dice[5-i] and \
       dice1.dice[4] == dice2.dice[5-j] and \
       dice1.dice[3] == dice2.dice[5-k]:
       if dice2.isSameDice(dice1):
           flag = True
       dice2.west()
       dice2.west()
       if dice2.isSameDice(dice1):
           flag = True

if flag:
    print("Yes")
else:
    print("No")