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:
import sys
answer = [i for i in input().split()]
inp = [i for i in input().split()]
if answer == inp:
    print("Yes")
    sys.exit()
for i in range(1,36):
    if i == 5 or i == 10 or i == 15 or i == 20:
        s = "W"
    elif (i >= 22 and i <= 25) or (i >= 27 and i <=30) or (i >=32 and i <=35):
        s = "E"
    else:
        s = "N"
    if s == "N":
        a = []
        a.append(inp[1])
        a.append(inp[5])
        a.append(inp[2])
        a.append(inp[3])
        a.append(inp[0])
        a.append(inp[4])
        inp = a
        if answer == inp:
            print("Yes")
            break
    elif s == "W":
        a = []
        a.append(inp[2])
        a.append(inp[1])
        a.append(inp[5])
        a.append(inp[0])
        a.append(inp[4])
        a.append(inp[3])
        inp = a
        if answer == inp:
            print("Yes")
            break
    elif s == "E":
        a = []
        a.append(inp[3])
        a.append(inp[1])
        a.append(inp[0])
        a.append(inp[5])
        a.append(inp[4])
        a.append(inp[2])
        inp = a
        if answer == inp:
            print("Yes")
            break
    if i == 35:
        print ("No")

Submission status: Wrong Answer

Solution code:
import sys
answer = [i for i in input().split()]
inp = [i for i in input().split()]
if answer == inp:
    print("Yes")
    sys.exit()
for i in range(1,37):
    if i == 6 or i == 11 or i == 16 or i == 21:
        s = "W"
    elif (i >= 23 and i <= 26) or (i >= 28 and i <=31) or (i >=33 and i <=36):
        s = "E"
    else:
        s = "N"
    if s == "N":
        a = []
        a.append(inp[1])
        a.append(inp[5])
        a.append(inp[2])
        a.append(inp[3])
        a.append(inp[0])
        a.append(inp[4])
        inp = a
        if answer == inp:
            print("Yes")
            break
    elif s == "W":
        a = []
        a.append(inp[2])
        a.append(inp[1])
        a.append(inp[5])
        a.append(inp[0])
        a.append(inp[4])
        a.append(inp[3])
        inp = a
        if answer == inp:
            print("Yes")
            break
    elif s == "E":
        a = []
        a.append(inp[3])
        a.append(inp[1])
        a.append(inp[0])
        a.append(inp[5])
        a.append(inp[4])
        a.append(inp[2])
        inp = a
        if answer == inp:
            print("Yes")
            break
    if i == 36:
        print ("No")

Submission status: Wrong Answer

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

import sys
import os
import math


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

def dice_roll(dice, c):
    copy = dice[:]
    if c == 'E':
        dice[2] = copy[0]
        dice[5] = copy[2]
        dice[3] = copy[5]
        dice[0] = copy[3]
    elif c == 'N':
        dice[0] = copy[1]
        dice[4] = copy[0]
        dice[5] = copy[4]
        dice[1] = copy[5]
        pass
    elif c == 'S':
        dice[1] = copy[0]
        dice[0] = copy[4]
        dice[4] = copy[5]
        dice[5] = copy[1]
    elif c == 'W':
        dice[0] = copy[2]
        dice[2] = copy[5]
        dice[5] = copy[3]
        dice[3] = copy[0]
    # Y???????????¢
    elif c == 'R':
        dice[2] = copy[1]
        dice[4] = copy[2]
        dice[3] = copy[4]
        dice[1] = copy[3]
    return dice

# up???????????????
num = 0
while dice0[0] != dice1[0]:
    if num % 2 == 0:
        dice0 = dice_roll(dice0, 'E')
    else:
        dice0 = dice_roll(dice0, 'N')
    num += 1

# front???????????????
while dice0[1] != dice1[1]:
    dice0 = dice_roll(dice0, 'R')

if dice0[2] == dice1[2]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

import sys
import os
import math


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

def dice_roll(dice, c):
    copy = dice[:]
    if c == 'E':
        dice[2] = copy[0]
        dice[5] = copy[2]
        dice[3] = copy[5]
        dice[0] = copy[3]
    elif c == 'N':
        dice[0] = copy[1]
        dice[4] = copy[0]
        dice[5] = copy[4]
        dice[1] = copy[5]
        pass
    elif c == 'S':
        dice[1] = copy[0]
        dice[0] = copy[4]
        dice[4] = copy[5]
        dice[5] = copy[1]
    elif c == 'W':
        dice[0] = copy[2]
        dice[2] = copy[5]
        dice[5] = copy[3]
        dice[3] = copy[0]
    # Y???????????¢
    elif c == 'R':
        dice[2] = copy[1]
        dice[4] = copy[2]
        dice[3] = copy[4]
        dice[1] = copy[3]
    return dice

# up???????????????
num = 0
while dice0[0] != dice1[0]:
    if num % 2 == 0:
        dice0 = dice_roll(dice0, 'E')
    else:
        dice0 = dice_roll(dice0, 'N')
    num += 1
    if num > 10:
        print('No')
        quit()

# front???????????????
num = 0
while dice0[1] != dice1[1]:
    dice0 = dice_roll(dice0, 'R')
    num += 1
    if num > 10:
        print('No')
        quit()

if dice0[2] == dice1[2] and dice0[3] == dice1[3] and dice0[4] == dice1[4] and dice0[5] == dice1[5]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
class Dice:

    def __init__(self, nums):
        self.nums = nums

    def rotate(self, direction):
        nums = self.nums
        if direction == "E":
            self.nums = [nums[3], nums[1], nums[0], nums[5], nums[4], nums[2]]
        elif direction == "W":
            self.nums = [nums[2], nums[1], nums[5], nums[0], nums[4], nums[3]]
        elif direction == "N":
            self.nums = [nums[1], nums[5], nums[2], nums[3], nums[0], nums[4]]
        elif direction == "S":
            self.nums = [nums[4], nums[0], nums[2], nums[3], nums[5], nums[1]]

    def upper_num(self):
        return self.nums[0]

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


def judge_nums(dice1_num, dice2_num):
    return dice1_num == dice2_num


flag = False
for N in range(4):
    if flag == True:
        break
    dice2.rotate("N")
    for W in range(4):
        dice2.rotate("W")
        if judge_nums(dice1.nums, dice2.nums):
            print("Yes")
            flag = True
            break
if flag==False:
    print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    """????????????????????????"""
    def __init__(self, s):
        self.s = [0 for _ in range(6)]
        self.s[0] = s[0]
        self.s[1] = s[1]
        self.s[2] = s[2]
        self.s[3] = s[3]
        self.s[4] = s[4]
        self.s[5] = s[5]

    def roll(self, direction):          # ???????????????????§??????¢????????¢
        temp = self.s[0]
        if direction == "E":
            self.s[0] = self.s[3]
            self.s[3] = self.s[5]
            self.s[5] = self.s[2]
            self.s[2] = temp
        elif direction == "N":
            self.s[0] = self.s[1]
            self.s[1] = self.s[5]
            self.s[5] = self.s[4]
            self.s[4] = temp
        elif direction == "S":
            self.s[0] = self.s[4]
            self.s[4] = self.s[5]
            self.s[5] = self.s[1]
            self.s[1] = temp
        elif direction == "W":
            self.s[0] = self.s[2]
            self.s[2] = self.s[5]
            self.s[5] = self.s[3]
            self.s[3] = temp

    def setposition(self, a, b):
        while 1:
            if self.s[0] == a:
                break
            self.roll("N")
            if self.s[0] == a:
                break
            self.roll("E")
        while 1:
            if self.s[1] == b:
                break
            self.roll("N")
            self.roll("E")
            self.roll("S")


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

a, b = dice1.s[0], dice1.s[1]
dice2.setposition(a, b)
if dice1.s == dice2.s:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    """????????????????????????"""
    def __init__(self, s):
        self.s = [0 for _ in range(6)]
        self.s[0] = s[0]
        self.s[1] = s[1]
        self.s[2] = s[2]
        self.s[3] = s[3]
        self.s[4] = s[4]
        self.s[5] = s[5]

    def roll(self, direction):          # ???????????????????§??????¢????????¢
        temp = self.s[0]
        if direction == "E":
            self.s[0] = self.s[3]
            self.s[3] = self.s[5]
            self.s[5] = self.s[2]
            self.s[2] = temp
        elif direction == "N":
            self.s[0] = self.s[1]
            self.s[1] = self.s[5]
            self.s[5] = self.s[4]
            self.s[4] = temp
        elif direction == "S":
            self.s[0] = self.s[4]
            self.s[4] = self.s[5]
            self.s[5] = self.s[1]
            self.s[1] = temp
        elif direction == "W":
            self.s[0] = self.s[2]
            self.s[2] = self.s[5]
            self.s[5] = self.s[3]
            self.s[3] = temp

    def setposition(self, a, b):
        for _ in range(6):
            if self.s[0] == a:
                break
            self.roll("N")
            if self.s[0] == a:
                break
            self.roll("E")
        for _ in range(6):
            if self.s[1] == b:
                break
            self.roll("N")
            self.roll("E")
            self.roll("S")


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

a, b = dice1.s[0], dice1.s[1]
dice2.setposition(a, b)
if dice1.s == dice2.s:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    """????????????????????????"""
    def __init__(self, s):
        self.s = [0 for _ in range(6)]
        self.s[0] = s[0]
        self.s[1] = s[1]
        self.s[2] = s[2]
        self.s[3] = s[3]
        self.s[4] = s[4]
        self.s[5] = s[5]

    def roll(self, direction):          # ???????????????????§??????¢????????¢
        temp = self.s[0]
        if direction == "E":
            self.s[0] = self.s[3]
            self.s[3] = self.s[5]
            self.s[5] = self.s[2]
            self.s[2] = temp
        elif direction == "N":
            self.s[0] = self.s[1]
            self.s[1] = self.s[5]
            self.s[5] = self.s[4]
            self.s[4] = temp
        elif direction == "S":
            self.s[0] = self.s[4]
            self.s[4] = self.s[5]
            self.s[5] = self.s[1]
            self.s[1] = temp
        elif direction == "W":
            self.s[0] = self.s[2]
            self.s[2] = self.s[5]
            self.s[5] = self.s[3]
            self.s[3] = temp

    def setposition(self, a, b):
        for _ in range(6):
            if self.s[0] == a:
                break
            self.roll("N")
            if self.s[0] == a:
                break
            self.roll("E")
        for _ in range(6):
            if self.s[1] == b:
                break
            self.roll("N")
            self.roll("E")
            self.roll("S")


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

a, b = dice1.s[0], dice1.s[1]
dice2.setposition(a, b)
if dice1.s == dice2.s:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.state =[1, 2, 3, 4, 5, 6]

    def setState(self, li):  # [top, S, E, W, N, under]
        self.state = li

    def move(self,str_direction):
        if str_direction == "N":
            self.state = [self.state[4], self.state[5],self.state[2],
                          self.state[3], self.state[0], self.state[4]]
        if str_direction == "W":
            self.state = [self.state[2], self.state[1], self.state[5],
                          self.state[0], self.state[4], self.state[3]]
        if str_direction == "E":
            self.state = [[self.state[3], self.state[1], self.state[0],
                          self.state[5], self.state[4], self.state[2]]]
        if str_direction == "S":
            self.state = [[self.state[4], self.state[0], self.state[2],
                          self.state[3], self.state[5], self.state[1]]]

    def rotate(self):
        self.state = [self.state[0], self.state[2], self.state[1],
                      self.state[4], self.state[3], self.state[5]]

    def sameDice(self, dice1):
        for i in self.state:
            if i not in dice1.state:
                return "No"
        count = 0
        while True:
            if self.state[0] == dice1.state[0]:
                break
            if count % 3 == 0:
                self.move("W")
            else:
                self.move("N")
        for _ in range(3):
            if self.state[1] == dice1.state[1]:
                break
            self.rotate()
        if self.state != dice1.state:
            return "No"
        return "Yes"




def main():
    myd1, myd2 = Dice(), Dice()
    myd1.setState(list(map(int, input().split())))
    myd2.setState(list(map(int, input().split())))
    print(myd1.sameDice(myd2))
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.state =[1, 2, 3, 4, 5, 6]

    def setState(self, li):  # [top, S, E, W, N, under]
        self.state = li

    def move(self,str_direction):
        if str_direction == "N":
            self.state = [self.state[1], self.state[5],self.state[2],
                          self.state[3], self.state[0], self.state[4]]
        if str_direction == "W":
            self.state = [self.state[2], self.state[1], self.state[5],
                          self.state[0], self.state[4], self.state[3]]
        if str_direction == "E":
            self.state = [self.state[3], self.state[1], self.state[0],
                          self.state[5], self.state[4], self.state[2]]
        if str_direction == "S":
            self.state = [self.state[4], self.state[0], self.state[2],
                          self.state[3], self.state[5], self.state[1]]

    def rotate(self):
        self.state = [self.state[0], self.state[2], self.state[1],
                      self.state[4], self.state[3], self.state[5]]

    def sameDice0(self, dice1):
        for i in self.state:
            if i not in dice1.state:
                return "No"
        count = 0
        while True:
            if self.state[0] == dice1.state[0]:
                break
            if count % 3 == 0:
                self.move("W")
            else:
                self.move("N")
        for _ in range(3):
            if self.state[1] == dice1.state[1]:
                break
            self.rotate()
        if self.state != dice1.state:
            return "No"
        return "Yes"

    def sameDice1(self, dice1):
        set1 = list()
        for _ in range(4):
            set1.append(self.state)
            self.move("N")
        if dice1.state in set1:
            return "Yes"
        return self.sameDice0(dice1)






def main():
    myd1, myd2 = Dice(), Dice()
    myd1.setState(list(map(int, input().split())))
    myd2.setState(list(map(int, input().split())))
    print(myd1.sameDice1(myd2))
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.state =[1, 2, 3, 4, 5, 6]

    def setState(self, li):  # [top, S, E, W, N, under]
        self.state = li

    def move(self, str_direction):
        if str_direction == "N":
            self.state = [self.state[1], self.state[5],self.state[2],
                          self.state[3], self.state[0], self.state[4]]
        if str_direction == "W":
            self.state = [self.state[2], self.state[1], self.state[5],
                          self.state[0], self.state[4], self.state[3]]
        if str_direction == "E":
            self.state = [self.state[3], self.state[1], self.state[0],
                          self.state[5], self.state[4], self.state[2]]
        if str_direction == "S":
            self.state = [self.state[4], self.state[0], self.state[2],
                          self.state[3], self.state[5], self.state[1]]

    def rotate(self):
        self.state = [self.state[0], self.state[2], self.state[1],
                      self.state[4], self.state[3], self.state[5]]

    def sameDice0(self, dice1):
        for i in self.state:
            if i not in dice1.state:
                return "No"
        count = 0
        while True:
            if self.state[0] == dice1.state[0]:
                break
            if count % 3 == 0:
                self.move("W")
            else:
                self.move("N")
        for _ in range(3):
            if self.state[1] == dice1.state[1]:
                break
            self.rotate()
        if self.state != dice1.state:
            return "No"
        return "Yes"

    def sameDice1(self, dice1):
        set1 = list()
        for _ in range(5):
            set1.append([self.state[0], self.state[1], self.state[2]])
            set1.append([self.state[4], self.state[5], self.state[3]])
            self.move("N")
        print(set1)
        d1 = [dice1.state[0], dice1.state[1], dice1.state[2]]
        d2 = [dice1.state[4], dice1.state[5], dice1.state[3]]
        if d1 in set1 or d2 in set1:
            return "Yes"
        return self.sameDice0(dice1)






def main():
    myd1, myd2 = Dice(), Dice()
    myd1.setState(list(map(int, input().split())))
    myd2.setState(list(map(int, input().split())))
    print(myd1.sameDice1(myd2))
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.state =[1, 2, 3, 4, 5, 6]

    def setState(self, li):  # [top, S, E, W, N, under]
        self.state = li

    def move(self, str_direction):
        if str_direction == "N":
            self.state = [self.state[1], self.state[5],self.state[2],
                          self.state[3], self.state[0], self.state[4]]
        if str_direction == "W":
            self.state = [self.state[2], self.state[1], self.state[5],
                          self.state[0], self.state[4], self.state[3]]
        if str_direction == "E":
            self.state = [self.state[3], self.state[1], self.state[0],
                          self.state[5], self.state[4], self.state[2]]
        if str_direction == "S":
            self.state = [self.state[4], self.state[0], self.state[2],
                          self.state[3], self.state[5], self.state[1]]

    def rotate(self):
        self.state = [self.state[0], self.state[2], self.state[1],
                      self.state[4], self.state[3], self.state[5]]

    def sameDice0(self, dice1):
        for i in self.state:
            if i not in dice1.state:
                return "No"
        count = 0
        while True:
            if self.state[0] == dice1.state[0]:
                break
            if count % 3 == 0:
                self.move("W")
            else:
                self.move("N")
        for _ in range(3):
            if self.state[1] == dice1.state[1]:
                break
            self.rotate()
        if self.state != dice1.state:
            return "No"
        return "Yes"

    def sameDice1(self, dice1):
        set1 = list()
        for _ in range(5):
            set1.append([self.state[0], self.state[1], self.state[2]])
            set1.append([self.state[4], self.state[5], self.state[3]])
            self.move("N")
        d1 = [dice1.state[0], dice1.state[1], dice1.state[2]]
        d2 = [dice1.state[4], dice1.state[5], dice1.state[3]]
        if d1 in set1 or d2 in set1:
            return "Yes"
        return "No"






def main():
    myd1, myd2 = Dice(), Dice()
    myd1.setState(list(map(int, input().split())))
    myd2.setState(list(map(int, input().split())))
    print(myd1.sameDice1(myd2))
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.state =[1, 2, 3, 4, 5, 6]

    def setState(self, li):  # [top, S, E, W, N, under]
        self.state = li

    def move(self, str_direction):
        if str_direction == "N":
            self.state = [self.state[1], self.state[5],self.state[2],
                          self.state[3], self.state[0], self.state[4]]
        if str_direction == "W":
            self.state = [self.state[2], self.state[1], self.state[5],
                          self.state[0], self.state[4], self.state[3]]
        if str_direction == "E":
            self.state = [self.state[3], self.state[1], self.state[0],
                          self.state[5], self.state[4], self.state[2]]
        if str_direction == "S":
            self.state = [self.state[4], self.state[0], self.state[2],
                          self.state[3], self.state[5], self.state[1]]

    def rotate(self):
        self.state = [self.state[0], self.state[2], self.state[1],
                      self.state[4], self.state[3], self.state[5]]

    def sameDice1(self, dice1):
        set1 = list()
        for _ in range(4):
            set1.append({self.state[0], self.state[1], self.state[2]})
            set1.append({self.state[4], self.state[5], self.state[3]})
            self.move("N")
        d1 = {dice1.state[0], dice1.state[1], dice1.state[2]}
        d2 = {dice1.state[4], dice1.state[5], dice1.state[3]}
        if d1 in set1 or d2 in set1:
            return "Yes"
        return "No"


def main():
    myd1, myd2 = Dice(), Dice()
    myd1.setState(list(map(int, input().split())))
    myd2.setState(list(map(int, input().split())))
    print(myd1.sameDice1(myd2))
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.state =[1, 2, 3, 4, 5, 6]

    def setState(self, li):  # [top, S, E, W, N, under]
        self.state = li

    def move(self, str_direction):
        if str_direction == "N":
            self.state = [self.state[1], self.state[5],self.state[2],
                          self.state[3], self.state[0], self.state[4]]
        if str_direction == "W":
            self.state = [self.state[2], self.state[1], self.state[5],
                          self.state[0], self.state[4], self.state[3]]
        if str_direction == "E":
            self.state = [self.state[3], self.state[1], self.state[0],
                          self.state[5], self.state[4], self.state[2]]
        if str_direction == "S":
            self.state = [self.state[4], self.state[0], self.state[2],
                          self.state[3], self.state[5], self.state[1]]

    def rotate(self):
        self.state = [self.state[0], self.state[2], self.state[1],
                      self.state[4], self.state[3], self.state[5]]

    def sameDice1(self, dice1):
        set1 = list()
        for _ in range(4):
            for __ in range(4):
                set1.append(self.state)
                self.rotate()
            self.move("N")
        self.move("E")
        for _ in range(4):
            set1.append(self.state)
            self.rotate()
        self.move("E")
        self.move("E")
        for _ in range(4):
            set1.append(self.state)
            self.rotate()
        if dice1.state in set1:
            return "Yes"
        return "No"


def main():
    myd1, myd2 = Dice(), Dice()
    myd1.setState(list(map(int, input().split())))
    myd2.setState(list(map(int, input().split())))
    print(myd1.sameDice1(myd2))
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.state =[1, 2, 3, 4, 5, 6]

    def setState(self, li):  # [top, S, E, W, N, under]
        self.state = li

    def move(self, str_direction):
        if str_direction == "N":
            self.state = [self.state[1], self.state[5],self.state[2],
                          self.state[3], self.state[0], self.state[4]]
        if str_direction == "W":
            self.state = [self.state[2], self.state[1], self.state[5],
                          self.state[0], self.state[4], self.state[3]]
        if str_direction == "E":
            self.state = [self.state[3], self.state[1], self.state[0],
                          self.state[5], self.state[4], self.state[2]]
        if str_direction == "S":
            self.state = [self.state[4], self.state[0], self.state[2],
                          self.state[3], self.state[5], self.state[1]]

    def rotate(self):
        self.state = [self.state[0], self.state[2], self.state[4],
                      self.state[1], self.state[3], self.state[5]]

    def sameDice1(self, dice1):
        set1 = list()
        for _ in range(4):
            for __ in range(4):
                set1.append(self.state)
                self.rotate()
            self.move("N")
        self.move("E")
        for _ in range(4):
            set1.append(self.state)
            self.rotate()
        self.move("E")
        self.move("E")
        for _ in range(4):
            set1.append(self.state)
            self.rotate()
        if dice1.state in set1:
            return "Yes"
        print(set1)
        return "No"


def main():
    myd1, myd2 = Dice(), Dice()
    myd1.setState(list(map(int, input().split())))
    myd2.setState(list(map(int, input().split())))
    print(myd1.sameDice1(myd2))
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    labels1 = list(map(int, input().split(' ')))
    labels2 = list(map(int, input().split(' ')))

    dice1 = Dice(labels1)
    dice2 = Dice(labels2)

    rotate_dice(dice2, dice1.top, dice1.front)

    print('Yes' if dice1.equals(dice2) else 'No')

def rotate_dice(dice, top, front):
    for j in range(8):
        if front == dice.front:
            break

        if j%4 == 0:
            dice.toE()

        dice.toN()

    for j in range(4):
        if top == dice.top:
            break

        dice.toE()

    return dice

class Dice:
    def __init__(self, labels):
        self.labels = labels

        self._tb = (0, 5)
        self._fb = (1, 4)
        self._lr = (3, 2)

    def toN(self):
        tb = self._tb
        self._tb = self._fb
        self._fb = tuple(reversed(tb))

        return self

    def toS(self):
        tb = self._tb
        self._tb = tuple(reversed(self._fb))
        self._fb = tb

        return self

    def toW(self):
        tb = self._tb
        self._tb = tuple(reversed(self._lr))
        self._lr = tb

        return self

    def toE(self):
        tb = self._tb
        self._tb = self._lr
        self._lr = tuple(reversed(tb))

        return self

    def get_top(self):
        return self.labels[self._tb[0]]

    def get_bottom(self):
        return self.labels[self._tb[1]]

    def get_front(self):
        return self.labels[self._fb[0]]

    def get_back(self):
        return self.labels[self._fb[1]]

    def get_left(self):
        return self.labels[self._lr[1]]

    def get_right(self):
        return self.labels[self._lr[1]]

    def equals(self, other):
        if self.top != other.top:
            return False

        if self.bottom != other.bottom:
            return False

        if self.front != other.front:
            return False

        if self.back != other.back:
            return False

        if self.left != other.left:
            return False

        if self.right != other.right:
            return False

        return True

    top    = property(get_top)
    bottom = property(get_bottom)
    front  = property(get_front)
    back   = property(get_back)
    left   = property(get_left)
    right  = property(get_right)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    labels1 = list(map(int, input().split(' ')))
    labels2 = list(map(int, input().split(' ')))

    dice1 = Dice(labels1)
    dice2 = Dice(labels2)

    print('Yes' if equals(dice1, dice2) else 'No')

def equals(d1, d2):
    for i in range(4):
        for j in range(4):
            if d1.equals(d2):
                return True

            d2.toE()
        d2.toN()

    return False

class Dice:
    def __init__(self, labels):
        self.labels = labels

        self._tb = (0, 5)
        self._fb = (1, 4)
        self._lr = (3, 2)

    def toN(self):
        tb = self._tb
        self._tb = self._fb
        self._fb = tuple(reversed(tb))

        return self

    def toS(self):
        tb = self._tb
        self._tb = tuple(reversed(self._fb))
        self._fb = tb

        return self

    def toW(self):
        tb = self._tb
        self._tb = tuple(reversed(self._lr))
        self._lr = tb

        return self

    def toE(self):
        tb = self._tb
        self._tb = self._lr
        self._lr = tuple(reversed(tb))

        return self

    def get_top(self):
        return self.labels[self._tb[0]]

    def get_bottom(self):
        return self.labels[self._tb[1]]

    def get_front(self):
        return self.labels[self._fb[0]]

    def get_back(self):
        return self.labels[self._fb[1]]

    def get_left(self):
        return self.labels[self._lr[0]]

    def get_right(self):
        return self.labels[self._lr[1]]

    top    = property(get_top)
    bottom = property(get_bottom)
    front  = property(get_front)
    back   = property(get_back)
    left   = property(get_left)
    right  = property(get_right)

    def equals(self, other):
        if not (self.top == other.top and self.bottom == other.bottom):
            return False

        if not (self.front == other.front and self.back == other.back):
            return False

        if not (self.left == other.left and self.right == other.right):
            return False

        return True

    def __str__(self):
        return str([self.top, self.front, self.right, self.left, self.back, self.bottom])

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def roll(inst):
    global u, s, e, w, n, d
    if inst == 'N':
        u, s, n, d = s, d, u, n
    elif inst == 'E':
        u, e, w, d = w, u, d, e
    elif inst == 'S':
        u, s, n, d = n, u, d, s
    elif inst == 'W':
        u, e, w, d = e, d, u, w

def rotate():
    global s, e, w, n
    s, e, n, w = e, n, w, s

u, s, e, w, n, d = map(int, input().split())
u1, s1, e1, w1, n1, d1 = map(int, input().split())
if u1 == u:
    pass
elif u1 == s:
    roll('N')
elif u1 == e:
    roll('W')
elif u1 == w:
    roll('E')
elif u1 == n:
    roll('S')
elif u1 == d:
    roll('N')
    roll('N')
if s1 == s:
    pass
elif s1 == e:
    rotate()
elif s1 == n:
    rotate()
    rotate()
elif s1 == w:
    rotate()
    rotate()
    rotate()
if u == u1 and s == s1 and e == e1 and w == w1 and n == n1 and d == d1:
    print('Yes')
else:
    print('No')