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:
#-*- coding:utf-8 -*-
import sys
rolls1 = raw_input().split()
rolls2 = raw_input().split()
testpare = (rolls1[0],rolls1[5])
testparerev = (rolls1[5],rolls1[0])
rolls2pare = [(rolls2[0],rolls2[5]),(rolls2[2],rolls2[3]),(rolls2[1],rolls2[4])]
#??????????????¢????????¢??§?????´??????????????????????????????????¢????
#??¨??¨????????¢?????£????????????????????´???????????¢???3????????¨??????????¢????????????????????????????
if testpare in rolls2pare:
    pareps = rolls2pare.index(testpare)
    revflag = False
elif testparerev in rolls2pare:
    pareps = rolls2pare.index(testparerev)
    revflag = True
else:
    print "No"
    sys.exit(0)
#?¬???????????????¢??\????????¨????????????????????£??????????¢????
#??????????????????????????????
li1 = [rolls1[1],rolls1[2],rolls1[4],rolls1[3]]
# print pareps
if pareps==0:
    if revflag:
        tmp = rolls2[2]
        rolls2[2] = rolls2[3]
        rolls2[3] = tmp
    li2 = [rolls2[1],rolls2[2],rolls2[4],rolls2[3]]
elif pareps==1:
    if revflag:
        tmp = rolls2[1]
        rolls2[1] = rolls2[4]
        rolls2[4] = tmp
        li2 = [rolls2[0],rolls2[1],rolls2[5],rolls2[4]]
elif pareps==2:
    if revflag:
        tmp = rolls2[0]
        rolls2[0] = rolls2[5]
        rolls2[5] = tmp
    li2 = [rolls2[0],rolls2[3],rolls2[5],rolls2[2]]
else:
    print "No"
    sys.exit(0)
#?????????????????´?¢????
print li1
print li2
i=0
j=li2.index(li1[0])
matchflag = True#else??\??£???????????´?????????
for x in xrange(4):
    print "%s : %s"%(li1[i],li2[j])
    if li1[i]==li2[j]:
        j+=1
        i+=1
    else:
        matchflag =False
        break
    if i>3:
        i=0
    if j>3:
        j=0
if matchflag:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
class Dice():
    def __init__(self, nums):
        self.nums = nums
        self.top, self.front, self.right = 0, 1, 2

    def move(self, op):
        for c in op:
            if c == 'N':
                self.top, self.front = self.front, 5 - self.top
            elif c == 'S':
                self.top, self.front = 5 - self.front, self.top
            elif c == 'E':
                self.top, self.right = 5 - self.right, self.top
            else:
                self.top, self.right = self.right, 5 - self.top

    def getRight(self, t, f):
        top, front = self.nums.index(t), self.nums.index(f)
        for c in "NNNNEEE":
            self.move(c)
            if top == self.top:
                break
        while True:
            self.move("ESW")
            if front == self.front:
                return self.nums[self.right]

dice1 = Dice([int(n) for n in input().split()])
dice2 = Dice([int(n) for n in input().split()])
dice2_right = dice2.getRight(dice1.nums[dice1.top], dice1.nums[dice1.front])
if dice1.nums[dice1.right] == dice2_right:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
class Dice:
    def __init__(self):
        self.front = '1'
        self.back = '6'
        self.top = '5'
        self.bottom = '2'
        self. right = '3'
        self.left = '4'
    def turnRight(self):
        temp = self.top
        self.top = self.left
        self.left = self.bottom
        self.bottom = self.right
        self.right = temp
        return self.top
    def turnLeft(self):
        temp = self.top
        self.top = self.right
        self.right = self.bottom
        self.bottom = self.left
        self.left = temp
        return self.top
    def turnFront(self):
        temp = self.top
        self.top = self.back
        self.back = self.bottom
        self.bottom = self.front
        self.front = temp
        return self.top
    def turnBack(self):
        temp = self.top
        self.top = self.front
        self.front = self.bottom
        self.bottom = self.back
        self.back = temp
        return self.top
    def __eq__(self, other):
        return (self.top, self.bottom, self.front, self.back, self.right, self.left) == other
    def __ne__(self, other):
        return (self.top, self.bottom, self.front, self.back, self.right, self.left) != other

A = Dice()
B = Dice()
A.top, A.front, A.right, A.left, A.back, A.bottom = input().split()
B.top, B.front, B.right, B.left, B.back, B.bottom = input().split()

for rotate in range(3):
    B.turnFront()
    if B.top == A.front:
        break
    B.turnRight()
    if B.top == A.front:
        break
B.turnFront()
for rotate in range(4):
    if B.top == A.top:
        if B == A:
            print('Yes')
        else:
            print('No')
        sys.exit()
    B.turnRight()
    
print('No')

Submission status: Wrong Answer

Solution code:
def move_dice(d, dir):
    if(dir == 'N'):
        d[0], d[1], d[4], d[5] = d[1], d[5], d[0], d[4]
    if(dir == 'S'):
        d[0], d[1], d[4], d[5] = d[4], d[0], d[5], d[1]
    if(dir == 'E'):
        d[0], d[2], d[3], d[5] = d[3], d[0], d[5], d[2]
    if(dir == 'W'):
        d[0], d[2], d[3], d[5] = d[2], d[5], d[0], d[3]

def rotate_right_dice(d):
    d[1], d[2], d[3], d[4] = d[3], d[1], d[4], d[2]

def to_up_dice(d, num):
    num_index = d.index(num)
    if(num_index==2 or num_index==3):
        move_dice(d, 'E')
    while(d[0] != num):
        move_dice(d, 'N')

def to_front_dice(d, num):
    while(d[1] != num):
        rotate_right_dice(d)

def equal_dice(d1, d2):
    if(d2[0] in d1): to_up_dice(d1, d2[0])
    else: return 'No'
    if(d2[1] in d1[1:5]):
        while(d1[1] != d2[1]):
            rotate_right_dice(d1)
    else: return 'No'
    if(d1 == d2): return 'Yes'
    else: return 'No'


dice1 = list(map(int, input().split()))
dice2 = list(map(int, input().split()))

print(equal_dice(dice1, dice2))

Submission status: Wrong Answer

Solution code:
def move_dice(d, dir):
    if(dir == 'N'):
        d[0], d[1], d[4], d[5] = d[1], d[5], d[0], d[4]
    if(dir == 'S'):
        d[0], d[1], d[4], d[5] = d[4], d[0], d[5], d[1]
    if(dir == 'E'):
        d[0], d[2], d[3], d[5] = d[3], d[0], d[5], d[2]
    if(dir == 'W'):
        d[0], d[2], d[3], d[5] = d[2], d[5], d[0], d[3]

def rotate_right_dice(d):
    d[1], d[2], d[3], d[4] = d[3], d[1], d[4], d[2]

def to_up_dice(d, num_index):
    move_num = {0:0, 1:3, 2:2, 3:0, 4:1, 5:2}
    if(num_index==2 or num_index==3):
        move_dice(d, 'E')
    for _ in range(move_num[num_index]):
        move_dice(d, 'N')

def to_front_dice(d, num):
    while(d[1] != num):
        rotate_right_dice(d)

def equal_dice(d1, d2):
    for i in range(6):
        tmp_d = d1
        to_up_dice(tmp_d, i)
        for _ in range(4):
            if(tmp_d == d2): return 'Yes'
            else: rotate_right_dice(tmp_d)
    return 'No'



dice1 = list(map(int, input().split()))
dice2 = list(map(int, input().split()))

print(equal_dice(dice1, dice2))

Submission status: Wrong Answer

Solution code:
#   2???????????????????????????????????????????????????????????°??????

#   ??????????????¢????????????????????????
class Dice:
    def __init__(self):
        self.top = 1
        self.front = 2
        self.right = 3
        self.left = 4
        self.back = 5
        self.bottom = 6
    #   2->1->5->6
    def turnSouth(self):
        temp = self.top
        self.top = self.back
        self.back = self.bottom
        self.bottom = self.front
        self.front = temp
        return self
    #   4->1->3->6
    def turnEast(self):
        temp = self.top
        self.top = self.left
        self.left = self.bottom
        self.bottom = self.right
        self.right = temp
        return self
    #   3->1->4->6
    def turnWest(self):
        temp = self.top
        self.top = self.right
        self.right = self.bottom
        self.bottom = self.left
        self.left = temp
        return self

    #   5->1->2->6
    def turnNorth(self):
        temp = self.top
        self.top = self.front
        self.front = self.bottom
        self.bottom = self.back
        self.back = temp
        return self
    #   2->3->5->4
    def turnRight(self):
        temp = self.front
        self.front = self.right
        self.right = self.back
        self.back = self.left
        self.left = temp
        return self
    #   2->4->5->3
    def turnRight(self):
        temp = self.front
        self.front = self.left
        self.left = self.back
        self.back = self.right
        self.right = temp
        return self
    def equalityJudge(self, Dice):
        if (self.top == Dice.top and self.front == Dice.front and self.bottom == Dice.bottom
            and self.back == Dice.back and self.right == Dice.right and self.left == Dice.left):
            return True
        else:
            return False

#   Dice?????????
Dice1 = Dice()
Dice2 = Dice()
#   ?????????????????¶????????\???
Dice1.top, Dice1.front, Dice1.right, Dice1.left, Dice1.back, Dice1.bottom = input().split()
Dice2.top, Dice2.front, Dice2.right, Dice2.left, Dice2.back, Dice2.bottom = input().split()

#   ?????????????????????????????????????????¨??????
#   ?????¢??????????????????????????????
for j in range(0, 3):
    if Dice1.top == Dice2.top:
        break
    Dice2.turnNorth()
#   ?????¢??????????????????????????????
for j in range(0, 3):
    if Dice1.top == Dice2.top:
        break
    Dice2.turnEast()
#   ??£??¢???????????????????????¢????????????????????¢
for j in range(0, 3):
    if Dice1.front == Dice2.front:
        break
    Dice2.turnRight()
if Dice1.equalityJudge(Dice2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#   2???????????????????????????????????????????????????????????°??????

#   ??????????????¢????????????????????????
class Dice:
    def __init__(self):
        self.top = 1
        self.front = 2
        self.right = 3
        self.left = 4
        self.back = 5
        self.bottom = 6
    #   2->1->5->6
    def turnSouth(self):
        temp = self.top
        self.top = self.back
        self.back = self.bottom
        self.bottom = self.front
        self.front = temp
        return self
    #   4->1->3->6
    def turnEast(self):
        temp = self.top
        self.top = self.left
        self.left = self.bottom
        self.bottom = self.right
        self.right = temp
        return self
    #   3->1->4->6
    def turnWest(self):
        temp = self.top
        self.top = self.right
        self.right = self.bottom
        self.bottom = self.left
        self.left = temp
        return self

    #   5->1->2->6
    def turnNorth(self):
        temp = self.top
        self.top = self.front
        self.front = self.bottom
        self.bottom = self.back
        self.back = temp
        return self
    #   2->3->5->4
    def turnRight(self):
        temp = self.front
        self.front = self.right
        self.right = self.back
        self.back = self.left
        self.left = temp
        return self
    #   2->4->5->3
    def turnRight(self):
        temp = self.front
        self.front = self.left
        self.left = self.back
        self.back = self.right
        self.right = temp
        return self
    def equals(self, Dice):
        if (self.top == Dice.top and self.front == Dice.front and self.bottom == Dice.bottom and
                    self.back == Dice.back and self.right == Dice.right and self.left == Dice.left):
            return True
        else:
            return False

#   Dice?????????
Dice1 = Dice()
Dice2 = Dice()
#   ?????????????????¶????????\???
Dice1.top, Dice1.front, Dice1.right, Dice1.left, Dice1.back, Dice1.bottom = input().split()
Dice2.top, Dice2.front, Dice2.right, Dice2.left, Dice2.back, Dice2.bottom = input().split()

#   ?????????????????????????????????????????¨??????
#   ?????¢??????????????????????????????
for j in range(0, 4):
    if Dice1.top == Dice2.top:
        break
    Dice2.turnNorth()
#   ?????¢??????????????????????????????
for j in range(0, 4):
    if Dice1.top == Dice2.top:
        break
    Dice2.turnEast()
#   ??£??¢???????????????????????¢????????????????????¢
for j in range(0, 4):
    if Dice1.front == Dice2.front:
        break
    Dice2.turnRight()
if Dice1.equals(Dice2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#   2???????????????????????????????????????????????????????????°??????

#   ??????????????¢????????????????????????
class Dice:
    def __init__(self):
        self.top = 1
        self.front = 2
        self.right = 3
        self.left = 4
        self.back = 5
        self.bottom = 6
    #   2->1->5->6
    def turnSouth(self):
        temp = self.top
        self.top = self.back
        self.back = self.bottom
        self.bottom = self.front
        self.front = temp
        return self
    #   4->1->3->6
    def turnEast(self):
        temp = self.top
        self.top = self.left
        self.left = self.bottom
        self.bottom = self.right
        self.right = temp
        return self
    #   3->1->4->6
    def turnWest(self):
        temp = self.top
        self.top = self.right
        self.right = self.bottom
        self.bottom = self.left
        self.left = temp
        return self

    #   5->1->2->6
    def turnNorth(self):
        temp = self.top
        self.top = self.front
        self.front = self.bottom
        self.bottom = self.back
        self.back = temp
        return self
    #   2->3->5->4
    def turnRight(self):
        temp = self.front
        self.front = self.right
        self.right = self.back
        self.back = self.left
        self.left = temp
        return self
    #   2->4->5->3
    def turnLeft(self):
        temp = self.front
        self.front = self.left
        self.left = self.back
        self.back = self.right
        self.right = temp
        return self
    def equals(self, Dice):
        if (self.top == Dice.top and self.front == Dice.front and self.bottom == Dice.bottom and
                    self.back == Dice.back and self.right == Dice.right and self.left == Dice.left):
            return True
        else:
            return False

#   Dice?????????
Dice1 = Dice()
Dice2 = Dice()
#   ?????????????????¶????????\???
Dice1.top, Dice1.front, Dice1.right, Dice1.left, Dice1.back, Dice1.bottom = input().split()
Dice2.top, Dice2.front, Dice2.right, Dice2.left, Dice2.back, Dice2.bottom = input().split()

#   ?????¢??????????????????????????????
for j in range(0, 3):
    if Dice1.top == Dice2.top:
        break
    Dice2.turnNorth()
#   ?????¢??????????????????????????????
for j in range(0, 3):
    if Dice1.top == Dice2.top:
        break
    Dice2.turnEast()
#   ??£??¢???????????????????????¢????????????????????¢
for j in range(0, 3):
    if Dice1.front == Dice2.front:
        break
    Dice2.turnRight()
if Dice1.equals(Dice2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#   2???????????????????????????????????????????????????????????°??????

#   ??????????????¢????????????????????????
#   top = 1 front = 2 right = 3 left = 4 back = 5 bottom = 6
class Dice:
    def __init__(self, nums):
        self.face = nums
    #   2->1->5->6
    def turnSouth(self):
        temp = self.face[0]
        self.face[0] = self.face[4]
        self.face[4] = self.face[5]
        self.face[5] = self.face[1]
        self.face[1] = temp
        return self
    #   4->1->3->6
    def turnEast(self):
        temp = self.face[0]
        self.face[0] = self.face[2]
        self.face[2] = self.face[5]
        self.face[5] = self.face[3]
        self.face[3] = temp
        return self
    #   3->1->4->6
    def turnWest(self):
        temp = self.face[0]
        self.face[0] = self.face[3]
        self.face[3] = self.face[5]
        self.face[5] = self.face[2]
        self.face[2] = temp
        return self
    #   5->1->2->6
    def turnNorth(self):
        temp = self.face[0]
        self.face[0] = self.face[1]
        self.face[1] = self.face[5]
        self.face[5] = self.face[4]
        self.face[4] = temp
    #   2->3->5->4
    def turnRight(self):
        temp = self.face[1]
        self.face[1] = self.face[2]
        self.face[2] = self.face[4]
        self.face[4] = self.face[3]
        self.face[3] = temp
        return self
    #   2->4->5->3
    def turnLeft(self):
        temp = self.face[1]
        self.face[1] = self.face[3]
        self.face[3] = self.face[4]
        self.face[4] = self.face[2]
        self.face[2] = temp
        return self
    def equals(self, Dice):
        if self.face == Dice.face:
            return True
        else:
            return False

#   Dice?????????
Dice1 = Dice(input().split())
Dice2 = Dice(input().split())

#   ?????¢??????????????????????????????
for i in range(0, 3):
    if Dice1.face[0] == Dice2.face[0]:
        break
    Dice2.turnNorth()
#    print("1", Dice2.face)
#   ?????¢??????????????????????????????
for i in range(0, 3):
    if Dice1.face[0] == Dice2.face[0]:
        break
    Dice2.turnEast()
#    print("2", Dice2.face)
#   ??£??¢???????????????????????¢????????????????????¢
for i in range(0, 3):
    if Dice1.face[1] == Dice2.face[1]:
        break
    Dice2.turnRight()
#    print("3", Dice2.face)
if Dice1.equals(Dice2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#   2???????????????????????????????????????????????????????????°??????

#   ??????????????¢????????????????????????
#   top = 1 front = 2 right = 3 left = 4 back = 5 bottom = 6
class Dice:
    def __init__(self, nums):
        self.face = nums
    #   2->1->5->6
    def turnSouth(self):
        temp = self.face[0]
        self.face[0] = self.face[4]
        self.face[4] = self.face[5]
        self.face[5] = self.face[1]
        self.face[1] = temp
        return self
    #   4->1->3->6
    def turnEast(self):
        temp = self.face[0]
        self.face[0] = self.face[2]
        self.face[2] = self.face[5]
        self.face[5] = self.face[3]
        self.face[3] = temp
        return self
    #   3->1->4->6
    def turnWest(self):
        temp = self.face[0]
        self.face[0] = self.face[3]
        self.face[3] = self.face[5]
        self.face[5] = self.face[2]
        self.face[2] = temp
        return self
    #   5->1->2->6
    def turnNorth(self):
        temp = self.face[0]
        self.face[0] = self.face[1]
        self.face[1] = self.face[5]
        self.face[5] = self.face[4]
        self.face[4] = temp
    #   2->3->5->4
    def turnRight(self):
        temp = self.face[1]
        self.face[1] = self.face[2]
        self.face[2] = self.face[4]
        self.face[4] = self.face[3]
        self.face[3] = temp
        return self
    #   2->4->5->3
    def turnLeft(self):
        temp = self.face[1]
        self.face[1] = self.face[3]
        self.face[3] = self.face[4]
        self.face[4] = self.face[2]
        self.face[2] = temp
        return self
    def equals(self, Dice):
        #   ?????¢??????????????????????????????
        for i in range(0, 3):
            if Dice1.face[0] == Dice2.face[0]:
                #   ??£??¢???????????????????????¢????????????????????¢
                for j in range(0, 3):
                    if Dice1.face[1] == Dice2.face[1]:
                        return True
                    Dice2.turnRight()
            Dice2.turnNorth()
        #   ?????¢??????????????????????????????
        for i in range(0, 3):
            if Dice1.face[0] == Dice2.face[0]:
                #   ??£??¢???????????????????????¢????????????????????¢
                for j in range(0, 3):
                    if Dice1.face[1] == Dice2.face[1]:
                        return True
                    Dice2.turnRight()
            Dice2.turnEast()
        return False

#   Dice?????????
Dice1 = Dice(input().split())
Dice2 = Dice(input().split())

if Dice1.equals(Dice2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#   2???????????????????????????????????????????????????????????°??????

#   ??????????????¢????????????????????????
#   top = 1 front = 2 right = 3 left = 4 back = 5 bottom = 6
class Dice:
    def __init__(self, nums):
        self.face = nums
    #   2->1->5->6
    def turnSouth(self):
        temp = self.face[0]
        self.face[0] = self.face[4]
        self.face[4] = self.face[5]
        self.face[5] = self.face[1]
        self.face[1] = temp
        return self
    #   4->1->3->6
    def turnEast(self):
        temp = self.face[0]
        self.face[0] = self.face[2]
        self.face[2] = self.face[5]
        self.face[5] = self.face[3]
        self.face[3] = temp
        return self
    #   3->1->4->6
    def turnWest(self):
        temp = self.face[0]
        self.face[0] = self.face[3]
        self.face[3] = self.face[5]
        self.face[5] = self.face[2]
        self.face[2] = temp
        return self
    #   5->1->2->6
    def turnNorth(self):
        temp = self.face[0]
        self.face[0] = self.face[1]
        self.face[1] = self.face[5]
        self.face[5] = self.face[4]
        self.face[4] = temp
    #   2->3->5->4
    def turnRight(self):
        temp = self.face[1]
        self.face[1] = self.face[2]
        self.face[2] = self.face[4]
        self.face[4] = self.face[3]
        self.face[3] = temp
        return self
    #   2->4->5->3
    def turnLeft(self):
        temp = self.face[1]
        self.face[1] = self.face[3]
        self.face[3] = self.face[4]
        self.face[4] = self.face[2]
        self.face[2] = temp
        return self
    def equals(self, Dice):
        #   ?????¢??????????????????????????????
        for i in range(0, 3):
            if self.face[0] == Dice.face[0]:
                #   ??£??¢???????????????????????¢????????????????????¢
                for j in range(0, 3):
                    if self.face[1] == Dice.face[1]:
                        if self.face == Dice.face:
                            return True
                    Dice.turnRight()
            Dice.turnNorth()
        #   ?????¢??????????????????????????????
        for i in range(0, 3):
            if self.face[0] == Dice.face[0]:
                #   ??£??¢???????????????????????¢????????????????????¢
                for j in range(0, 3):
                    if self.face[1] == Dice.face[1]:
                        if self.face == Dice.face:
                            return True
                    Dice.turnRight()
            Dice.turnEast()
        return False

#   Dice?????????
Dice1 = Dice(input().split())
Dice2 = Dice(input().split())

if Dice1.equals(Dice2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#   2???????????????????????????????????????????????????????????°??????


#   ??????????????¢????????????????????????
#   top = 1 front = 2 right = 3 left = 4 back = 5 bottom = 6
class Dice:
    def __init__(self, nums):
        self.face = nums

    #   2->1->5->6
    def turnSouth(self):
        temp = self.face[0]
        self.face[0] = self.face[4]
        self.face[4] = self.face[5]
        self.face[5] = self.face[1]
        self.face[1] = temp
        return self

    #   4->1->3->6
    def turnEast(self):
        temp = self.face[0]
        self.face[0] = self.face[2]
        self.face[2] = self.face[5]
        self.face[5] = self.face[3]
        self.face[3] = temp
        return self

    #   3->1->4->6
    def turnWest(self):
        temp = self.face[0]
        self.face[0] = self.face[3]
        self.face[3] = self.face[5]
        self.face[5] = self.face[2]
        self.face[2] = temp
        return self

    #   5->1->2->6
    def turnNorth(self):
        temp = self.face[0]
        self.face[0] = self.face[1]
        self.face[1] = self.face[5]
        self.face[5] = self.face[4]
        self.face[4] = temp

    #   2->3->5->4
    def turnRight(self):
        temp = self.face[1]
        self.face[1] = self.face[2]
        self.face[2] = self.face[4]
        self.face[4] = self.face[3]
        self.face[3] = temp
        return self

    #   2->4->5->3
    def turnLeft(self):
        temp = self.face[1]
        self.face[1] = self.face[3]
        self.face[3] = self.face[4]
        self.face[4] = self.face[2]
        self.face[2] = temp
        return self

    def equals(self, another):
        #   ?????¢??????????????????????????????
        for i in range(0, 4):
            if self.face[0] == another.face[0]:
                #   ??£??¢???????????????????????¢????????????????????¢
                for j in range(0, 4):
                    if self.face[1] == another.face[1]:
                        if self.face == another.face:
                            return True
                    another.turnRight()
                another.turnNorth()
        #   ?????¢??????????????????????????????
        for i in range(0, 4):
            if self.face[0] == another.face[0]:
                #   ??£??¢???????????????????????¢????????????????????¢
                for j in range(0, 4):
                    if self.face[1] == another.face[1]:
                        if self.face == another.face:
                            return True
                    another.turnRight()
            another.turnEast()
        return False

#   Dice?????????
Dice1 = Dice(input().split())
Dice2 = Dice(input().split())

if Dice1.equals(Dice2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

class dise:
    def __init__(self, label):
        self.label1 = label[0]
        self.label2 = label[1]
        self.label3 = label[2]
        self.label4 = label[3]
        self.label5 = label[4]
        self.label6 = label[5]
    
    def N_rotation(self):
        reg = self.label1
        self.label1 = self.label2
        self.label2 = self.label6
        self.label6 = self.label5
        self.label5 = reg
        
    def E_rotation(self):
        reg = self.label1
        self.label1 = self.label4
        self.label4 = self.label6
        self.label6 = self.label3
        self.label3 = reg
        
    def S_rotation(self):
        reg = self.label1
        self.label1 = self.label5
        self.label5 = self.label6
        self.label6 = self.label2
        self.label2 = reg
        
    def W_rotation(self):
        reg = self.label1
        self.label1 = self.label3
        self.label3 = self.label6
        self.label6 = self.label4
        self.label4 = reg
    
    def right_rotation(self):
        reg = self.label2
        self.label2 = self.label3
        self.label3 = self.label5
        self.label5 = self.label4
        self.label4 = reg
    

    def search(self, other_dise):
        count = 0
        while True:
            count += 1
            self.N_rotation()
            if other_dise[0] == self.label1:
                break
            self.E_rotation()
            if other_dise[0] == self.label1:
                break
            if count == 6:
                print("No")
                break

            count = 0            
        while True :
            count += 1
            self.right_rotation()
            if other_dise[1] == self.label2 and other_dise[2] == self.label3 and other_dise[3] == self.label4 and other_dise[4] == self.label5:
                print("Yes")
                break
            if count == 4:
                print("No")
                break
#init_dise = input().split()
#times = int(input())

dise1 = dise(input().split())
dise2 = input().split()
dise1.search(dise2)

Submission status: Wrong Answer

Solution code:
class dice:
    def __init__(self,label):
        self.label = {i+1: l for i,l in enumerate(label)}
    def roll(self,op):
        l = self.label
        if   op=='N': self.label = {1:l[2], 2:l[6], 3:l[3], 4:l[4], 5:l[1], 6:l[5]}
        elif op=='E': self.label = {1:l[4], 2:l[2], 3:l[1], 4:l[6], 5:l[5], 6:l[3]}
        elif op=='W': self.label = {1:l[3], 2:l[2], 3:l[6], 4:l[1], 5:l[5], 6:l[4]}
        elif op=='S': self.label = {1:l[5], 2:l[1], 3:l[3], 4:l[4], 5:l[6], 6:l[2]}
    def yaw(self,op):
        l = self.label
        if   op=='CW' : self.label = {1:l[1], 2:l[3], 3:l[5], 4:l[2], 5:l[4], 6:l[6]}
        elif op=='CCW': self.label = {1:l[1], 2:l[4], 3:l[2], 4:l[5], 5:l[3], 6:l[6]}
    def get_label(self,i=0):
        if 1 <= i <= 6:
            return self.label[i]
        else:
            return [self.label[x] for x in range(1,7)] 


if __name__ == '__main__':
    d0 = dice(list(map(int,input().split())))
    d1 = dice(list(map(int,input().split())))
    result='No'
    if set(d0.get_label())==set(d1.get_label()):
        t,f = d1.get_label(1),d1.get_label(2)
        for _ in range(3):
            if d0.get_label(1) == t: break
            d0.roll('E')
        if d0.get_label(1) != t:
            d0.roll('N')
            if d0.get_label(1) != t:
                for _ in range(2): d0.roll('N')
        if d0.get_label(2) != f:
            for _ in range(3):
                d0.yaw('CW')
                if d0.get_label(2) == f: break
        if d0.get_label()[2:6]==d1.get_label()[2:6]:
            result='Yes'
    print(result)

Submission status: Wrong Answer

Solution code:
class dice:
    def __init__(self,label):
        self.label = {i+1: l for i,l in enumerate(label)}
    def roll(self,op):
        l = self.label
        if   op=='N': self.label = {1:l[2], 2:l[6], 3:l[3], 4:l[4], 5:l[1], 6:l[5]}
        elif op=='E': self.label = {1:l[4], 2:l[2], 3:l[1], 4:l[6], 5:l[5], 6:l[3]}
        elif op=='W': self.label = {1:l[3], 2:l[2], 3:l[6], 4:l[1], 5:l[5], 6:l[4]}
        elif op=='S': self.label = {1:l[5], 2:l[1], 3:l[3], 4:l[4], 5:l[6], 6:l[2]}
    def yaw(self,op):
        l = self.label
        if   op=='CW' : self.label = {1:l[1], 2:l[3], 3:l[5], 4:l[2], 5:l[4], 6:l[6]}
        elif op=='CCW': self.label = {1:l[1], 2:l[4], 3:l[2], 4:l[5], 5:l[3], 6:l[6]}
    def get_label(self,i=0):
        if 1 <= i <= 6:
            return self.label[i]
        else:
            return [self.label[x] for x in range(1,7)] 


if __name__ == '__main__':
    d0 = dice(list(map(int,input().split())))
    d1 = dice(list(map(int,input().split())))
    result='No'
    if set(d0.get_label())==set(d1.get_label()):
        for i in range(6):
            for _ in range(4):
                if d0.get_label()==d1.get_label():
                    result='Yes'
                    break
                d0.yaw('CW')
            if d0.get_label()==d1.get_label():
                break
            if i < 4:
                d0.roll('E')
            elif i == 4:
                d0.roll('N')
            else:
                for _ in range(2): d0.roll('N')
    print(result)