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, dice):
        self.dice = dice
        self.buff = [n for n in dice]
        self.t = dice[0]
        self.s = dice[1]
        self.e = dice[2]
        self.w = dice[3]
        self.n = dice[4]
        self.b = dice[5]
    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 spin(self):
        self.dice[1] = self.buff[3]
        self.dice[2] = self.buff[1]
        self.dice[4] = self.buff[2]
        self.dice[3] = self.buff[4]
        self.buff = [n for n in self.dice]
    def isSameDice(self, anotherDice):
        if self.t == anotherDice.t:
            pass
        elif self.t == anotherDice.e:
            anotherDice.west()
        elif self.t == anotherDice.w:
            anotherDice.east()
        elif self.t == anotherDice.n:
            anotherDice.south()
        elif self.t == anotherDice.s:
            anotherDice.north()
        else:
            anotherDice.north()
            anotherDice.north()
        for k in range(4):
            self.spin()
            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


import random

nums1 = [int(x) for x in input().split()]
nums2 = [int(x) for x in input().split()]
dice1 = Dice(nums1)
dice2 = Dice(nums2)

if dice1.isSameDice(dice2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import deque

class Dice:
    MASK = {
    'N':(1, 5, 2, 3, 0, 4),
    'E':(3, 1, 0, 5, 4, 2),
    'S':(4, 0, 2, 3, 5, 1),
    'W':(2, 1, 5, 0, 4, 3)
    }

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

    def roll(self, command):
        for c in list(command):
            self.dice = [self.dice[i] for i in Dice.MASK[c]]
        return self.dice

    def pip(self):
        return self.dice[0]

    def right(self, up, south):
        pass

    def equals(self, other):
        for _ in range(6):
            self.roll('E')
            if self.dice == other.dice:
                return 'Yes'

        return 'No'


if __name__ == '__main__':
    dice1 = Dice(input().split())
    dice2 = Dice(input().split())
    print(dice1.equals(dice2))

Submission status: Wrong Answer

Solution code:
from collections import deque

class Dice:
    MASK = {
    'N':(1, 5, 2, 3, 0, 4),
    'E':(3, 1, 0, 5, 4, 2),
    'S':(4, 0, 2, 3, 5, 1),
    'W':(2, 1, 5, 0, 4, 3)
    }

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

    def roll(self, command):
        for c in list(command):
            self.dice = [self.dice[i] for i in Dice.MASK[c]]
        return self.dice

    def pip(self):
        return self.dice[0]

    def right(self, up, south):
        pass

    def equals(self, other):
        cnt = 6

        for _ in range(cnt):
            if self.dice[1] == other.dice[1] and self.dice[4] == other.dice[4]:
                break
            self.roll('S')

        for _ in range(cnt):
            if self.dice == other.dice:
                return 'Yes'
            self.roll('E')

        return 'No'


if __name__ == '__main__':
    dice1 = Dice(input().split())
    dice2 = Dice(input().split())
    print(dice1.equals(dice2))

Submission status: Wrong Answer

Solution code:
from collections import deque

class Dice:
    MASK = {
    'N':(1, 5, 2, 3, 0, 4),
    'E':(3, 1, 0, 5, 4, 2),
    'S':(4, 0, 2, 3, 5, 1),
    'W':(2, 1, 5, 0, 4, 3)
    }

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

    def roll(self, command):
        for c in list(command):
            self.dice = [self.dice[i] for i in Dice.MASK[c]]
        return self.dice

    def pip(self):
        return self.dice[0]

    def right(self, up, south):
        pass

    def equals(self, other):
        cnt = 7

        for _ in range(cnt):
            if self.dice[1] == other.dice[1] and self.dice[4] == other.dice[4]:
                break
            self.roll('S')

        for _ in range(cnt):
            if self.dice == other.dice:
                return 'Yes'
            self.roll('E')

        return 'No'


if __name__ == '__main__':
    dice1 = Dice(input().split())
    dice2 = Dice(input().split())
    print(dice1.equals(dice2))

Submission status: Wrong Answer

Solution code:
from collections import deque

class Dice:
    MASK = {
    'N':(1, 5, 2, 3, 0, 4),
    'E':(3, 1, 0, 5, 4, 2),
    'S':(4, 0, 2, 3, 5, 1),
    'W':(2, 1, 5, 0, 4, 3)
    }

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

    def roll(self, command):
        for c in list(command):
            self.dice = [self.dice[i] for i in Dice.MASK[c]]
        return self.dice

    def pip(self):
        return self.dice[0]

    def right(self, up, south):
        pass

    def equals(self, other):
        for _ in range(5):
            for __ in range(5):
                self.roll('E')
                if self.dice == other.dice:
                    return 'Yes'
            self.roll('S')

        return 'No'


if __name__ == '__main__':
    dice1 = Dice(input().split())
    dice2 = Dice(input().split())
    print(dice1.equals(dice2))

Submission status: Wrong Answer

Solution code:
L = [[0,1,2,3,4,5],[0,2,3,4,1,5],[0,3,4,1,2,5],[0,4,1,2,3,5],[1,0,3,2,5,4],[1,3,2,5,0,4],[1,2,5,0,3,4],[1,5,0,3,2,4],[2,0,1,4,5,3],[2,1,4,5,0,3],[2,4,5,0,1,3],[2,5,0,1,4,3],[3,0,4,1,5,2],[3,4,1,5,0,2],[3,1,5,0,4,2],[3,5,0,4,1,2],[4,0,2,3,5,1],[4,2,3,5,0,1],[4,3,5,0,2,1],[4,5,0,2,3,1],[5,1,3,2,4,0],[5,3,2,4,1,0],[5,2,4,1,3,0],[5,4,1,3,2,0]]
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
f0 = 0
for l in L:
    j = 0
    f1 = 1
    while j < 6 and f1 == 1:
        if a[j] != b[l[j]]:
            f1 = 0
        else:
            j += 1
    if j == 6:
        f0 = 1
        break
if f0 == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
L = [[0,1,2,3,4,5],[0,2,3,4,1,5],[0,3,4,1,2,5],[0,4,1,2,3,5],[1,0,3,2,5,4],[1,3,2,5,0,4],[1,2,5,0,3,4],[1,5,0,3,2,4],[2,0,1,4,5,3],[2,1,4,5,0,3],[2,4,5,0,1,3],[2,5,0,1,4,3],[3,0,4,1,5,2],[3,4,1,5,0,2],[3,1,5,0,4,2],[3,5,0,4,1,2],[4,0,2,3,5,1],[4,2,3,5,0,1],[4,3,5,0,2,1],[4,5,0,2,3,1],[5,1,3,2,4,0],[5,3,2,4,1,0],[5,2,4,1,3,0],[5,4,1,3,2,0]]
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
A = []
q = 0
while q < 6:
    a0 = a[q:] + a[:q]
    A.append(a0)
    q += 1
f0 = 0
for a in A:
        for l in L:
            j = 0
            f1 = 1
            while j < 6 and f1 == 1:
                if a[j] != b[l[j]]:
                    f1 = 0
                else:
                    j += 1
            if j == 6:
                f0 = 1
                break
if f0 == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
L = [[0,1,2,3,4,5],[0,2,3,4,1,5],[0,3,4,1,2,5],[0,4,1,2,3,5],[1,0,3,2,5,4],[1,3,2,5,0,4],[1,2,5,0,3,4],[1,5,0,3,2,4],[2,0,1,4,5,3],[2,1,4,5,0,3],[2,4,5,0,1,3],[2,5,0,1,4,3],[3,0,4,1,5,2],[3,4,1,5,0,2],[3,1,5,0,4,2],[3,5,0,4,1,2],[4,0,2,3,5,1],[4,2,3,5,0,1],[4,3,5,0,2,1],[4,5,0,2,3,1],[5,1,3,2,4,0],[5,3,2,4,1,0],[5,2,4,1,3,0],[5,4,1,3,2,0]]
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
A = []
q = 0
while q < 6:
    a0 = a[q:] + a[:q]
    A.append(a0)
    q += 3
f0 = 0
for a in A:
        for l in L:
            j = 0
            f1 = 1
            while j < 6 and f1 == 1:
                if a[j] != b[l[j]]:
                    f1 = 0
                else:
                    j += 1
            if j == 6:
                f0 = 1
                break
if f0 == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
class Dice:
    """サイコロを操作するクラス"""
    def __init__(self, num):
        self.num = num
    def roll_north(self):
        tmp = self.num[:]
        self.num[0] = tmp[1]
        self.num[1] = tmp[5]
        self.num[4] = tmp[0]
        self.num[5] = tmp[4]
    def roll_east(self):
        tmp = self.num[:]
        self.num[0] = tmp[3]
        self.num[2] = tmp[0]
        self.num[3] = tmp[5]
        self.num[5] = tmp[2]
    def roll_right(self):
        tmp = self.num[:]
        self.num[1] = tmp[3]
        self.num[2] = tmp[1]
        self.num[3] = tmp[4]
        self.num[4] = tmp[2]
    def print_dice(self):
        print(self.num)

dice1 = Dice(list(map(int, input().split())))
dice2 = Dice(list(map(int, input().split())))
while not(dice1.num[0] == dice2.num[0] or dice1.num[1] == dice2.num[1]):
    dice2.roll_north()
while dice1.num[0] != dice2.num[0]:
    dice2.roll_east()
while dice1.num[1] != dice2.num[1]:
    dice2.roll_right()
if dice1.num == dice2.num:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    """サイコロを操作するクラス"""
    def __init__(self, num):
        self.num = num
    def roll_north(self):
        tmp = self.num[:]
        self.num[0] = tmp[1]
        self.num[1] = tmp[5]
        self.num[4] = tmp[0]
        self.num[5] = tmp[4]
    def roll_east(self):
        tmp = self.num[:]
        self.num[0] = tmp[3]
        self.num[2] = tmp[0]
        self.num[3] = tmp[5]
        self.num[5] = tmp[2]
    def roll_right(self):
        tmp = self.num[:]
        self.num[1] = tmp[3]
        self.num[2] = tmp[1]
        self.num[3] = tmp[4]
        self.num[4] = tmp[2]
    def print_dice(self):
        print(self.num)

dice1 = Dice(list(map(int, input().split())))
dice2 = Dice(list(map(int, input().split())))
for i in range(4):
    dice2.roll_north()
    for k in range(4):
        dice2.roll_east()
        if dice1.num == dice2.num:
            break
if dice1.num == dice2.num:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    """サイコロを操作するクラス"""
    def __init__(self, num):
        self.num = num
    def roll_north(self):
        tmp = self.num[:]
        self.num[0] = tmp[1]
        self.num[1] = tmp[5]
        self.num[4] = tmp[0]
        self.num[5] = tmp[4]
    def roll_east(self):
        tmp = self.num[:]
        self.num[0] = tmp[3]
        self.num[2] = tmp[0]
        self.num[3] = tmp[5]
        self.num[5] = tmp[2]
    def roll_right(self):
        tmp = self.num[:]
        self.num[1] = tmp[3]
        self.num[2] = tmp[1]
        self.num[3] = tmp[4]
        self.num[4] = tmp[2]
    def print_dice(self):
        print(self.num)

dice1 = Dice(list(map(int, input().split())))
dice2 = Dice(list(map(int, input().split())))
for i in range(4):
    dice2.roll_north()
    for k in range(4):
        dice2.roll_east()
        if dice1.num == dice2.num:
            break
if dice1.num == dice2.num:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    """サイコロを操作するクラス"""
    def __init__(self, num):
        self.num = num
    def roll_north(self):
        tmp = self.num[:]
        self.num[0] = tmp[1]
        self.num[1] = tmp[5]
        self.num[4] = tmp[0]
        self.num[5] = tmp[4]
    def roll_east(self):
        tmp = self.num[:]
        self.num[0] = tmp[3]
        self.num[2] = tmp[0]
        self.num[3] = tmp[5]
        self.num[5] = tmp[2]
    def roll_right(self):
        tmp = self.num[:]
        self.num[1] = tmp[3]
        self.num[2] = tmp[1]
        self.num[3] = tmp[4]
        self.num[4] = tmp[2]
    def print_dice(self):
        print(self.num)

dice1 = Dice(list(map(int, input().split())))
dice2 = Dice(list(map(int, input().split())))
flg = False
for i in range(10):
    if flg == True:
        break
    dice2.roll_north()
    for k in range(10):
        if flg == True:
            break
        dice2.roll_east()
        for l in range(10):
            dice2.roll_right()
            if dice1.num == dice2.num:
                flg = True
                break
if flg:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, v1, v2, v3, v4, v5, v6):
        self.faces = [(v1, v6), (v2, v5), (v3, v4)]

    def rotate(self):
        (top, btm), (fnt, bck), (rgt, lft) = self.faces
        self.faces = [(top, btm), (rgt, lft), (bck, fnt)]

    def turnover(self):
        (top, btm), (fnt, bck), (rgt, lft) = self.faces
        self.faces = [(btm, top), (bck, fnt), (rgt, lft)]

    def moves(self):
        def r(dice):
            dice.rotate()

        def t(dice):
            dice.turnover()

        yield r
        yield r
        yield r
        yield t
        yield r
        yield r
        yield r

    def __eq__(self, other):
        for move in self.moves():
            move(self)
            if self.faces == other.faces:
                return True

        self.rotate()
        return self.faces == other.faces


def run():
    dice1 = Dice(*[int(i) for i in input().split()])
    dice2 = Dice(*[int(i) for i in input().split()])

    if dice1 == dice2:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    run()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, v1, v2, v3, v4, v5, v6):
        self.faces = [(v1, v6), (v2, v5), (v3, v4)]

    def rotate(self):
        (top, btm), (fnt, bck), (rgt, lft) = self.faces
        self.faces = [(top, btm), (rgt, lft), (bck, fnt)]

    def turnover(self):
        (top, btm), (fnt, bck), (rgt, lft) = self.faces
        self.faces = [(btm, top), (bck, fnt), (rgt, lft)]

    def moves(self):
        def r(dice):
            dice.rotate()

        def t(dice):
            dice.turnover()

        yield r
        yield r
        yield r
        yield t
        yield r
        yield r
        yield r

    def __eq__(self, other):
        for move in self.moves():
            move(self)
            if self.faces == other.faces:
                return True

        self.turnover()
        return self.faces == other.faces


def run():
    dice1 = Dice(*[int(i) for i in input().split()])
    dice2 = Dice(*[int(i) for i in input().split()])

    if dice1 == dice2:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    run()

Submission status: Wrong Answer

Solution code:
class Dice:
    TOP, SOUTH, EAST, WEST, NORTH, BOTTOM = 0, 1, 2, 3, 4, 5
    def __init__(self, d):
        self.dice = d
        self.top = d[0]
        self.south = d[1]
        self.east = d[2]
        self.west = d[3]
        self.north = d[4]
        self.bottom = d[5]

    def __eq__(self, other):
        d2 = Dice(other.dice)
        if not d2.set_top_front(self.top, self.south):
            return False
        else:
            return self.dice == d2.dice

        
    def set_top_front(self, top, front):
        for i, n in enumerate(self.dice):
            if n == top:
                if i == Dice.TOP: pass
                elif i == Dice.SOUTH: self.move("N")
                elif i == Dice.EAST: self.move("W")
                elif i == Dice.WEST: self.move("E")
                elif i == Dice.NORTH: self.move("S")
                elif i == Dice.BOTTOM:
                    self.move("S")
                    self.move("S")

                break
        else:
            return False
        
        for i, n in enumerate(self.dice):
            if n == front:
                if i == Dice.TOP: return False
                elif i == Dice.SOUTH: pass
                elif i == Dice.EAST: self.move("R")
                elif i == Dice.WEST: self.move("L")
                elif i == Dice.NORTH:
                    self.move("R")
                    self.move("R")
                elif i == Dice.BOTTOM: return False

                break
        else:
            return False

        return True
        
    def move(self, d):
        if d == "N":
            self.move_north()
        elif d == "W":
            self.move_west()
        elif d == "S":
            self.move_south()
        elif d == "E":
            self.move_east()
        elif d == "R":
            self.move_right()
        elif d == "L":
            self.move_left()

        self.dice = [
            self.top,
            self.south,
            self.east,
            self.west,
            self.north,
            self.bottom,
        ]

    def move_right(self):
        self.north, self.west, self.south, self.east \
            = self.west, self.south, self.east, self.north

    def move_left(self):
        self.north, self.west, self.south, self.east \
            = self.east, self.north, self.west, self.south

    def move_north(self):
        self.top, self.south, self.bottom, self.north \
            = self.south, self.bottom, self.north, self.top

    def move_south(self):
        self.top, self.south, self.bottom, self.north \
            = self.north, self.top, self.south, self.bottom

    def move_east(self):
        self.top, self.east, self.bottom, self.west \
            = self.west, self.top, self.east, self.bottom

    def move_west(self):
        self.top, self.east, self.bottom, self.west \
            = self.east, self.bottom, self.west, self.top

if __name__ == "__main__":
    import re

    nums1 = [int(n) for n in re.split(r"\s+", input().strip())]
    dice1 = Dice(nums1)

    nums2 = [int(n) for n in re.split(r"\s+", input().strip())]
    dice2 = Dice(nums2)

    if dice1 == dice2:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
def north(list):
    List = []
    List.append(list[1])
    List.append(list[5])
    List.append(list[2])
    List.append(list[3])
    List.append(list[0])
    List.append(list[4])
    return List

def west(list):
    List = []
    List.append(list[2])
    List.append(list[1])
    List.append(list[5])
    List.append(list[0])
    List.append(list[4])
    List.append(list[3])
    return List
    
def south(list):
    List = []
    List.append(list[4])
    List.append(list[0])
    List.append(list[2])
    List.append(list[3])
    List.append(list[5])
    List.append(list[1])
    return List

def east(list):
    List = []
    List.append(list[3])
    List.append(list[1])
    List.append(list[0])
    List.append(list[5])
    List.append(list[4])
    List.append(list[2])
    return List
dice = list(map(int, input().split()))
D = [dice]
for i in range(0, 3):
    D.append(north(D[i]))
D.append(south(west(D[0])))
D.append(south(east(D[0])))
for i in range(6):
    for j in range(3):
        if j == 0:
            D.append(east(D[i + j]))
        else:
            D.append(east(D[5 + 3 * i + j]))

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

for i in range(len(D)):
    if dice2 == D[i]:
        print('Yes')
        break
if i == len(D) - 1:
    print('No')

Submission status: Wrong Answer

Solution code:
#! python3
# dice_iii.py

class dice():
    def __init__(self, arr):
        self.top = arr[0]
        self.south = arr[1]
        self.east = arr[2]
        self.west = arr[3]
        self.north = arr[4]
        self.bottom = arr[5]

    def rotate(self, ope):
        if ope == 'S':
            self.top, self.north, self.bottom, self.south = self.north, self.bottom, self.south, self.top
        elif ope == 'N':
            self.top, self.south, self.bottom, self.north = self.south, self.bottom, self.north, self.top
        elif ope == 'E':
            self.top, self.west, self.bottom, self.east = self.west, self.bottom, self.east, self.top
        elif ope == 'W':
            self.top, self.east, self.bottom, self.west = self.east, self.bottom, self.west, self.top

    def get_surfaces(self):
        return [self.top, self.south, self.east, self.north, self.west, self.bottom]

dc1 = dice([int(x) for x in input().split(' ')])
dc2 = dice([int(x) for x in input().split(' ')])

judged = False
if len((dc1.get_surfaces() and dc2.get_surfaces())) == 6:
    if dc2.top != dc1.top:
        opes = ['S', 'E', 'S', 'E', 'S']
        for op in opes:
            dc2.rotate(op)
            if dc2.top == dc1.top: break
    for i in range(4):
        if dc2.south == dc1.south:
            break
        dc2.rotate('R')
    if (dc1.east == dc2.east) and (dc1.north == dc2.north) and (dc1.bottom == dc2.bottom):
        judged = True

if judged:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#! python3
# dice_iii.py

class dice():
    def __init__(self, arr):
        self.top = arr[0]
        self.south = arr[1]
        self.east = arr[2]
        self.west = arr[3]
        self.north = arr[4]
        self.bottom = arr[5]

    def rotate(self, ope):
        if ope == 'S':
            self.top, self.north, self.bottom, self.south = self.north, self.bottom, self.south, self.top
        elif ope == 'N':
            self.top, self.south, self.bottom, self.north = self.south, self.bottom, self.north, self.top
        elif ope == 'E':
            self.top, self.west, self.bottom, self.east = self.west, self.bottom, self.east, self.top
        elif ope == 'W':
            self.top, self.east, self.bottom, self.west = self.east, self.bottom, self.west, self.top
        elif ope == 'R': # clockwise
            self.south, self.east, self.north, self.west = self.east, self.north, self.west, self.south
        elif ope == 'L': # reversed clockwise
            self.south, self.east, self.north, self.west = self.west, self.north, self.east, self.south

    def get_surfaces(self):
        return [self.top, self.south, self.east, self.north, self.west, self.bottom]

dc1 = dice([int(x) for x in input().split(' ')])
dc2 = dice([int(x) for x in input().split(' ')])

judged = False
if len((dc1.get_surfaces() and dc2.get_surfaces())) == 6:
    if dc2.top != dc1.top:
        opes = ['S', 'E', 'S', 'E', 'S']
        for op in opes:
            dc2.rotate(op)
            print('top', dc2.get_surfaces())
            if dc2.top == dc1.top: break
    for i in range(4):
        print(dc2.get_surfaces())
        if dc2.south == dc1.south:
            break
        dc2.rotate('R')
    if dc1.get_surfaces() == dc2.get_surfaces():
        judged = True

if judged:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#! python3
# dice_iii.py

class dice():
    def __init__(self, arr):
        self.top = arr[0]
        self.south = arr[1]
        self.east = arr[2]
        self.west = arr[3]
        self.north = arr[4]
        self.bottom = arr[5]

    def rotate(self, ope):
        if ope == 'S':
            self.top, self.north, self.bottom, self.south = self.north, self.bottom, self.south, self.top
        elif ope == 'N':
            self.top, self.south, self.bottom, self.north = self.south, self.bottom, self.north, self.top
        elif ope == 'E':
            self.top, self.west, self.bottom, self.east = self.west, self.bottom, self.east, self.top
        elif ope == 'W':
            self.top, self.east, self.bottom, self.west = self.east, self.bottom, self.west, self.top
        elif ope == 'R': # clockwise
            self.south, self.east, self.north, self.west = self.east, self.north, self.west, self.south
        elif ope == 'L': # reversed clockwise
            self.south, self.east, self.north, self.west = self.west, self.north, self.east, self.south

    def get_surfaces(self):
        return [self.top, self.south, self.east, self.north, self.west, self.bottom]

dc1 = dice([int(x) for x in input().split(' ')])
dc2 = dice([int(x) for x in input().split(' ')])

judged = False
if len((dc1.get_surfaces() and dc2.get_surfaces())) == 6:
    if dc2.top != dc1.top:
        opes = ['S', 'E', 'S', 'E', 'S']
        for op in opes:
            dc2.rotate(op)
            if dc2.top == dc1.top: break
    for i in range(4):
        if dc2.south == dc1.south: break
        dc2.rotate('R')
    if dc1.get_surfaces() == dc2.get_surfaces():
        judged = True

if judged:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

class Dice:
    def __init__(self, labels):
        self.labels = labels
    def east(self):
        self.labels[0], self.labels[2], self.labels[5], self.labels[3] = self.labels[3], self.labels[0], self.labels[2], self.labels[5]
    def west(self):
        self.labels[0], self.labels[2], self.labels[5], self.labels[3] = self.labels[2], self.labels[5], self.labels[3], self.labels[0]
    def north(self):
        self.labels[0], self.labels[1], self.labels[5], self.labels[4] = self.labels[1], self.labels[5], self.labels[4], self.labels[0]
    def south(self):
        self.labels[0], self.labels[1], self.labels[5], self.labels[4] = self.labels[4], self.labels[0], self.labels[1], self.labels[5]

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

south_cnt = 0

for i in range(6):
    if dice1.labels[0] == dice2.labels[0] and dice1.labels[1] == dice2.labels[1] and dice1.labels[2] == dice2.labels[2] and dice1.labels[3] == dice2.labels[3] and dice1.labels[4] == dice2.labels[4] and dice1.labels[5] == dice2.labels[5]:
      print("Yes")
      sys.exit()

    if dice1.labels[0] == dice2.labels[0]:
        dice2.south()
        dice2.east()
        dice2.north()

    elif south_cnt == 3:
        dice2.south()
        south_cnt += 1
    else:
        dice2.east()
    
print("No")

Submission status: Wrong Answer

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


class Dice:
    def __init__(self, n):
        self.upper    = n[0]
        self.backward = n[1]
        self.right    = n[2]
        self.left     = n[3]
        self.ahead    = n[4]
        self.bottom   = n[5]

    def roll_north(self):
        self.upper, self.ahead, self.bottom, self.backward = self.backward, self.upper, self.ahead, self.bottom

    def roll_south(self):
        self.upper, self.ahead, self.bottom, self.backward = self.ahead, self.bottom, self.backward, self.upper

    def roll_east(self):
        self.upper, self.right, self.bottom, self.left = self.left, self.upper, self.right, self.bottom

    def roll_west(self):
        self.upper, self.right, self.bottom, self.left = self.right, self.bottom, self.left, self.upper

    def roll_side(self):
        self.ahead, self.right, self.backward, self.left = self.left, self.ahead, self.right, self.backward


dice1_num = list(map(int, input().split()))
dice2_num = list(map(int, input().split()))

if dice1_num.sort() is not dice2_num.sort():
    print("No")
    state = 'No'
else:
    dice1 = Dice(dice1_num)
    dice2 = Dice(dice2_num)
    state = 'Yes'

while state is not 'No':

    if dice1.upper is dice2.upper and dice1.ahead is dice2.ahead:
        break

    if dice2.upper is dice1.left:
        dice1.roll_east()

    elif dice2.upper is dice1.right:
        dice1.roll_west()

    while not (dice2.upper == dice1.upper or dice2.ahead == dice1.ahead):
        dice1.roll_north()

    while dice2.upper is not dice1.upper:
        dice1.roll_east()

    while dice2.ahead is not dice1.ahead:
        dice1.roll_side()

if dice1.left is dice2.left and dice1.right is dice2.right and dice1.backward is dice2.backward:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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


class Dice:
    def __init__(self, n):
        self.upper    = n[0]
        self.backward = n[1]
        self.right    = n[2]
        self.left     = n[3]
        self.ahead    = n[4]
        self.bottom   = n[5]

    def roll_north(self):
        self.upper, self.ahead, self.bottom, self.backward = self.backward, self.upper, self.ahead, self.bottom

    def roll_south(self):
        self.upper, self.ahead, self.bottom, self.backward = self.ahead, self.bottom, self.backward, self.upper

    def roll_east(self):
        self.upper, self.right, self.bottom, self.left = self.left, self.upper, self.right, self.bottom

    def roll_west(self):
        self.upper, self.right, self.bottom, self.left = self.right, self.bottom, self.left, self.upper

    def roll_side(self):
        self.ahead, self.right, self.backward, self.left = self.left, self.ahead, self.right, self.backward


dice1_num = list(map(int, input().split()))
dice2_num = list(map(int, input().split()))

dice1_num_sort = dice1_num.copy()
dice2_num_sort = dice2_num.copy()

if dice1_num_sort.sort() is not dice2_num_sort.sort():
    state = 'No'
else:
    dice1 = Dice(dice1_num)
    dice2 = Dice(dice2_num)
    state = 'Yes'

while state is not 'No':

    if dice1.upper is dice2.upper and dice1.ahead is dice2.ahead:
        break

    if dice2.upper is dice1.left:
        dice1.roll_east()

    elif dice2.upper is dice1.right:
        dice1.roll_west()

    while not (dice2.upper == dice1.upper or dice2.ahead == dice1.ahead):
        dice1.roll_north()

    while dice2.upper is not dice1.upper:
        dice1.roll_east()

    while dice2.ahead is not dice1.ahead:
        dice1.roll_side()

if dice1.left is dice2.left and dice1.right is dice2.right and dice1.backward is dice2.backward:
    print('Yes')
else:
    print('No')