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(object):
    """
    6??¢???????????????
    ?????¢???top, ?????¢???bottom???????????\??????4??¢??????????????? north, south, east, west ??¨?????¶???
    """
    def __init__(self, faces):
        # faces???????????????????????¨?????????????????????????????????
        # ???????????? top, south, east, west, north, bottom ????????§????´????????????????????????¨??????????????????????????§???top??????????????£????????????
        self.top = faces[0]
        self.south = faces[1]
        self.east = faces[2]
        self.west = faces[3]
        self.north = faces[4]
        self.bottom = faces[5]
        self.values = (self.top, self.south, self.east, self.west, self.north, self.bottom)

    def rotate(self, dir):
        # ???????????????dir??????????????????????????¢?????????
        # ????????????N, S, E, W???????????????????????????(1??????)??§????????????
        if dir == 'N':
            temp = self.top
            self.top = self.south
            self.south = self.bottom
            self.bottom = self.north
            self.north = temp
        elif dir == 'S':
            temp = self.top
            self.top = self.north
            self.north = self.bottom
            self.bottom = self.south
            self.south = temp
        elif dir == 'E':
            temp = self.top
            self.top = self.west
            self.west = self.bottom
            self.bottom = self.east
            self.east = temp
        elif dir == 'W':
            temp = self.top
            self.top = self.east
            self.east = self.bottom
            self.bottom = self.west
            self.west = temp

    def get_top_value(self):
        return self.top

    def get_bottom_value(self):
        return self.bottom

    def get_east_value(self):
        return self.east

    def get_west_value(self):
        return self.west

    def get_north_value(self):
        return self.north

    def get_south_value(self):
        return self.south

    def spin(self, count=1):
        """???????????????top??¨bottom?????????????????????????????????????????????????????????????¨??????????90????????¢?????????
        ?????????????????§???1?????????????????????????????§?????§?????°??????????????????
        """
        for i in range(count):
            temp = self.south
            self.south = self.east
            self.east = self.north
            self.north = self.west
            self.west = temp

    def place(self, upper, front):
        """ ?????¢(top)??¨??¨??¢(south)?????????????????????upper, front??¨???????????????????????????????????¢?????????
        ??????????????????????????¨??????????????????????????????????????¢?????????????????????????????????????????????????????´???????????????(ValueError)?????????????????????
        """
        # ????????? top == upper??¨????????????????????¢?????????
        if upper not in self.values or front not in self.values:
            raise ValueError
        if upper == self.top:
            pass
        elif upper == self.east:
            self.rotate('W')
        elif upper == self.west:
            self.rotate('E')
        elif upper == self.north:
            self.rotate('S')
        elif upper == self.south:
            self.rotate('N')
        else:
            self.rotate('N')
            self.rotate('N')
        # ????????????south == front ??¨????????????????????¢?????????
        if front == self.bottom:
            raise ValueError
        while front != self.south:
            self.spin()

    def is_identical(self, dice):
        """ ????????¨???????????????????????????????§????????????£?????????????¢?????????? (?????¢???????????°??????????????????????????????)
        :param dice: ?????????????????????????????????
        :return: ???????§????????????????(True/False)
        """
        # 6??¢????????????????§????????????£?????????????¢????
        my_v = sorted(list(self.values))
        d_v = sorted(list(dice.values))
        if my_v != d_v:
            return False

        # ?????¢????§????????¢????
        try:
            dice.place(self.get_top_value(), self.get_south_value())
        except ValueError:
            return False
        if self.get_east_value() != dice.get_east_value():
            return False
        self.spin()
        try:
            dice.place(self.get_top_value(), self.get_south_value())
        except ValueError:
            return False
        if self.get_east_value() != dice.get_east_value():
            return False
        self.spin()
        try:
            dice.place(self.get_top_value(), self.get_south_value())
        except ValueError:
            return False
        if self.get_east_value() != dice.get_east_value():
            return False
        self.spin()
        try:
            dice.place(self.get_top_value(), self.get_south_value())
        except ValueError:
            return False
        if self.get_east_value() != dice.get_east_value():
            return False

        return True


if __name__ == '__main__':
    # ??????????????\???
    dice1_values = [int(x) for x in input().split(' ')]
    dice2_values = [int(x) for x in input().split(' ')]


    # ??????????????????????????????????§?????????????????¢??????????
    d1 = Dice(dice1_values)
    d2 = Dice(dice2_values)

    if d1.is_identical(d2):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
d1 = list(map(int, input().split()))
d2 = {v: k for k, v in enumerate(list(map(int, input().split())))}
adjacent = {v: k for k, v in d2.items()}
p = [(-1,2,4,1,3,-1),
     (3,-1,0,5,-1,2),
     (1,5,-1,-1,0,4),
     (4,0,-1,-1,5,1),
     (2,-1,5,0,-1,3),
     (-1,3,1,4,2,-1)]

top, front, right = d1[0], d1[1], d1[2]
x, y = d2[top], d2[front]
try:
    if right == adjacent[p[x][y]]:
        print("Yes")
    else:
        print("No")
except KeyError:
    print("No")

Submission status: Wrong Answer

Solution code:
p = [(-1,2,4,1,3,-1),
     (3,-1,0,5,-1,2),
     (1,5,-1,-1,0,4),
     (4,0,-1,-1,5,1),
     (2,-1,5,0,-1,3),
     (-1,3,1,4,2,-1)]

d1 = list(map(int, input().split()))
top, front, right = d1[0], d1[1], d1[2]
d2 = list(map(int, input().split()))
d1 = {v: k for k, v in enumerate(d1)}
d2 = {v: k for k, v in enumerate(d2)}
boo = True if len(d1) == 6 and len(d2) == 6 else False

if boo:
    x, y = d2[top], d2[front]
    try:
        if right == d2[p[x][y]]:
            print("Yes")
        else:
            print("No")
    except KeyError:
        print("No")

else:
    d1 = [(k, v) for k, v in enumerate(d1)]
    d2 = [(k, v) for k, v in enumerate(d2)]
    for m in range(5, 1, -1):
        if d1[m][1] != d1[m-1][1]:
            x, y = d1[m][0], d1[m-1][0]
            t1, f1, r1 = d1[m][0], d1[m-1][0], d1[p[x][y]][0]
            break
        else:
            t1, f1, r1 = 0, 0, 0
    for m in range(5, 1, -1):
        if d2[m][1] != d2[m-1][1]:
            x, y = d2[m][0], d2[m-1][0]
            t2, f2, r2 = d2[m][0], d2[m-1][0], d2[p[x][y]][0]

    if t2 == r1 and r2 == t1:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
p = [(-1,2,4,1,3,-1),
     (3,-1,0,5,-1,2),
     (1,5,-1,-1,0,4),
     (4,0,-1,-1,5,1),
     (2,-1,5,0,-1,3),
     (-1,3,1,4,2,-1)]

d1 = list(map(int, input().split()))
top, front, right = d1[0], d1[1], d1[2]
d2 = list(map(int, input().split()))
da1 = {v: k for k, v in enumerate(d1)}
da2 = {v: k for k, v in enumerate(d2)}
boo = True if len(d1) == 6 and len(d2) == 6 else False
if boo:
    x, y = da2[top], da2[front]
    adjacent = {v: k for k, v in da2.items()}
    try:
        if right == adjacent[p[x][y]]:
            print("Yes")
        else:
            print("No")
    except KeyError:
        print("No")

else:
    d1 = [(k, v) for k, v in enumerate(d1)]
    d2 = [(k, v) for k, v in enumerate(d2)]
    print(len(d1))
    print(len(d2))
    for m in range(5, 1, -1):
        if d1[m][1] != d1[m-1][1]:
            x, y = d1[m][0], d1[m-1][0]
            t1, f1, r1 = d1[m][0], d1[m-1][0], d1[p[x][y]][0]
            break
        else:
            t1, f1, r1 = 0, 0, 0
    for m in range(5, 1, -1):
        if d2[m][1] != d2[m-1][1]:
            x, y = d2[m][0], d2[m-1][0]
            t2, f2, r2 = d2[m][0], d2[m-1][0], d2[p[x][y]][0]

    if t2 == r1 and r2 == t1:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
class Dice:
    rmap = [[2,3,5,4,2],
            [1,4,6,3,1],
            [1,2,6,5,1],
            [5,6,2,1,5],
            [3,6,4,1,3],
            [4,5,3,2,4] ]

    def __init__(self,list):
        self.num = list

    def lookup_right_side(self,u,s):
        index_upside = self.num.index(u)
        map_arr = self.rmap[index_upside]
        map_arr_dice_val = [ self.num[i-1] for i in map_arr ]
        index_next_map = map_arr_dice_val.index(s) + 1
        index_rightside = map_arr[index_next_map]
        return self.num[index_rightside-1]

spots1 = map(int,raw_input().split())
spots2 = map(int,raw_input().split())

dice1 = Dice(spots1)
dice2 = Dice(spots2)

if dice1.lookup_right_side(spots1[0],spots1[1]) == dice2.lookup_right_side(spots1[0],spots1[1]):
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
class Dice(object):
    def __init__(self,num):
        self.f=num[0]
        self.s=num[1]
        self.e=num[2]
        self.w=num[3]
        self.n=num[4]
        self.b=num[5]
    def create(self,order):
        if order=='N':
            return [self.s,self.b,self.e,self.w,self.f,self.n]
        elif order=='S':
            return [self.n,self.f,self.e,self.w,self.b,self.s]
        elif order=='E':
            return [self.w,self.s,self.f,self.b,self.n,self.e]
        else:
            return [self.e,self.s,self.b,self.f,self.n,self.w]
    def judge(self,dice_2):
        T={0:'N',1:'E',2:'S',3:'W'}
        while True:
            if self.f==dice_2.f:
                if self.b==dice_2.b:
                    side_1=''.join(list(map(str,[self.s,self.w,self.n,self.e])))*2
                    side_2=''.join(list(map(str,[dice_2.s,dice_2.w,dice_2.n,dice_2.e])))
                    if side_2 in side_1:
                        return 'Yes'
                    else:
                        return 'No'
                else:return 'No'
            elif self.f==dice_2.b:
                dice_2=Dice(dice_2.create('N'))
            else:
                t=[dice_2.s,dice_2.w,dice_2.n,dice_2.e]
                dice_2=Dice(dice_2.create(T[t.index(self.f)]))
num_1=list(map(int,input().split()))
num_2=list(map(int,input().split()))
dice_1=Dice(num_1)
dice_2=Dice(num_2)
T={0:'N',1:'E',2:'S',3:'W'}
print(dice_1.judge(dice_2))

Submission status: Wrong Answer

Solution code:
class Dice(object):
    def __init__(self,num):
        self.f=num[0]
        self.s=num[1]
        self.e=num[2]
        self.w=num[3]
        self.n=num[4]
        self.b=num[5]
    def create(self,order):
        if order=='N':
            return [self.s,self.b,self.e,self.w,self.f,self.n]
        elif order=='S':
            return [self.n,self.f,self.e,self.w,self.b,self.s]
        elif order=='E':
            return [self.w,self.s,self.f,self.b,self.n,self.e]
        else:
            return [self.e,self.s,self.b,self.f,self.n,self.w]
    def judge(self,dice_2):
        T={0:'N',1:'E',2:'S',3:'W'}
        m=[dice_2.s,dice_2.w,dice_2.n,dice_2.e,dice_2.f,dice_2.b]
        for i in range(6):
            if m[i]==self.f:#?????¢??¨?????´???????????????????????????
                if i==4:temp=dice_2#?????¢??????????????´
                elif i==5:temp=Dice(Dice(dice_2.create('N')).create('N'))#?????¢??¨?????´
                else:temp=Dice(dice_2.create(T[m.index(self.f)]))#??´??¢??¨?????´

                if self.b==temp.b:
                        side_1=''.join(list(map(str,[self.s,self.w,self.n,self.e])))*2
                        side_2=''.join(list(map(str,[temp.s,temp.w,temp.n,temp.e])))
                        if side_2 in side_1:return 'Yes'
        return 'No'
num_1=list(map(int,input().split()))
num_2=list(map(int,input().split()))
dice_1=Dice(num_1)
dice_2=Dice(num_2)
print(dice_1.judge(dice_2))

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, init_values = ['1','2','3','4','5','6']):
        self.value = dict(zip(["top", "front","right","left","back","bottom"]\
                             , init_values))
    #north, south, east and west
    def roll(self, direction):
        if direction == 'N':
            self.value["top"], self.value["front"], self.value["bottom"], self.value["back"] = \
            self.value["front"], self.value["bottom"], self.value["back"], self.value["top"]
        elif direction == 'S':
            self.value["top"], self.value["back"], self.value["bottom"], self.value["front"] = \
            self.value["back"], self.value["bottom"], self.value["front"], self.value["top"]
        elif direction == 'E':
            self.value["top"], self.value["left"], self.value["bottom"], self.value["right"] = \
            self.value["left"], self.value["bottom"], self.value["right"], self.value["top"]
        elif direction == 'W':
            self.value["top"], self.value["right"], self.value["bottom"], self.value["left"] = \
            self.value["right"], self.value["bottom"], self.value["left"], self.value["top"]
        else:
            print("Error: illegal format.")
    # clockwise, counterclockwise
    def spin(self, direction):
        if direction == 'CW':
            self.value["front"], self.value["right"], self.value["back"], self.value["left"] = \
            self.value["right"], self.value["back"], self.value["left"], self.value["front"]
        elif direction == 'CCW':
            self.value["front"], self.value["left"], self.value["back"], self.value["right"] = \
            self.value["left"], self.value["back"], self.value["right"], self.value["front"]
        else:
            print("Error: illegal format.")
            
dice1 = Dice(input().split())
dice2 = Dice(input().split())

for _ in range(3):
    if dice1.value["top"] == dice2.value["top"]:
        break
    dice2.roll('S')
    if dice1.value["top"] == dice2.value["top"]:
        break
    dice2.roll('E')

for _ in range(3):
    if dice1.value["front"] == dice2.value["front"]:
        break
    dice2.spin('CW')

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

Submission status: Wrong Answer

Solution code:
R = ((1,2,4,3),(2,0,3,5),(0,1,5,4))
f,g = input().split(), input().split()

t, s, e = map(f.index, g[:3])
for j in R:
    if e in j:
        continue
    print('Yes' if (e == R.index(j)) ^ ((j.index(t) - j.index(s)) %4 == 3) else 'No')
    break

Submission status: Wrong Answer

Solution code:
R = ((1,2,4,3),(2,0,3,5),(0,1,5,4))
f,g = input().split(), input().split()

t, s, e = map(f.index, g[:3])
for j in R:
    if e in j:
        continue
    print('Yes' if (e == R.index(j)) ^ ((j.index(t) - j.index(s)) %4 == 1) else 'No')
    break

Submission status: Wrong Answer

Solution code:
def ch3(t,s,e):
    if e in (t, s, 5-t, 5-s):
        return 1
    m = min(e,5-e)
    for j in R:
        if m in j:
            continue
        return 0 if (e == R.index(j)) ^ ((j.index(t) - j.index(s)) %4 == 3) else 1
        break
R = ((1,2,4,3),(2,0,3,5),(0,1,5,4))
f,g = input().split(), input().split()

t,s,e,w,n,b = map(f.index, g)
if ch3(t,s,e)*ch3(t,n,w)*ch3(s,w,b)*ch3(e,b,n):
    print('Yes')
else: 
    print('No')

Submission status: Wrong Answer

Solution code:
n1 = [int(i) for i in input().split()]
n2 = [int(i) for i in input().split()]


class Dice(object):
    def __init__(self,num):
        self.n = num[4]
        self.e = num[2]
        self.w = num[3]
        self.s = num[1]
        self.center = num[0]
        self.back = num[5]

    def number(self):
        number = [self.center, self.s, self.e, self.w, self.n, self.back]
        return number

    def move(self,str):
        if str == 'N':
            x = self.n
            self.n = self.center
            self.center = self.s
            self.s = self.back
            self.back = x
            return self.center
        elif str == 'S':
            x = self.s
            self.s = self.center
            self.center = self.n
            self.n = self.back
            self.back = x
            return self.center
        elif str== 'E':
            x = self.e
            self.e = self.center
            self.center = self.w
            self.w = self.back
            self.back = x
            return self.center
        elif str == 'W':
            x = self.w
            self.w = self.center
            self.center = self.e
            self.e = self.back
            self.back = x
            return self.center

dice1 = Dice(n1)
dice2 = Dice(n2)
status = dice1.center

while True:
    if dice1.center == dice2.center:
        break
    dice1.move('N')
    if status == dice1.center:
        while True:
            if dice1.center == dice2.center:
                break
            dice1.move('E')


bool1 = dice1.number() == dice2.number()

dice1 = Dice(n1)
dice2 = Dice(n2)
status = dice1.center

while True:
    if dice1.center == dice2.center:
        break
    dice1.move('E')
    if status == dice1.center:
        while True:
            if dice1.center == dice2.center:
                break
            dice1.move('N')

bool2 = dice1.number() == dice2.number()

print('Yes') if bool1 == True or bool2 == True else print('No')

Submission status: Wrong Answer

Solution code:
n1 = [int(i) for i in input().split()]
n2 = [int(i) for i in input().split()]


class Dice(object):
    def __init__(self,num):
        self.n = num[4]
        self.e = num[2]
        self.w = num[3]
        self.s = num[1]
        self.center = num[0]
        self.back = num[5]

    def number(self):
        number = [self.center, self.s, self.e, self.w, self.n, self.back]
        return number

    def move(self,str):
        if str == 'N':
            x = self.n
            self.n = self.center
            self.center = self.s
            self.s = self.back
            self.back = x
            return self.center
        elif str == 'S':
            x = self.s
            self.s = self.center
            self.center = self.n
            self.n = self.back
            self.back = x
            return self.center
        elif str== 'E':
            x = self.e
            self.e = self.center
            self.center = self.w
            self.w = self.back
            self.back = x
            return self.center
        elif str == 'W':
            x = self.w
            self.w = self.center
            self.center = self.e
            self.e = self.back
            self.back = x
            return self.center

dice1 = Dice(n1)
dice2 = Dice(n2)
bool1 = False
bool2 = False
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool1 = True
        break
    dice1.move('N')

for j in range(4):
    if dice1.number() == dice2.number():
        bool1 = True
        break
    dice1.move('E')



dice1 = Dice(n1)
dice2 = Dice(n2)
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool2 = True
        break
    dice1.move('E')

for j in range(4):
    if dice1.number() == dice2.number():
        bool2 = True
        break
    dice1.move('N')

print('Yes') if bool1 == True or bool2 == True else print('No')

Submission status: Wrong Answer

Solution code:
n1 = [int(i) for i in input().split()]
n2 = [int(i) for i in input().split()]


class Dice(object):
    def __init__(self,num):
        self.n = num[4]
        self.e = num[2]
        self.w = num[3]
        self.s = num[1]
        self.center = num[0]
        self.back = num[5]

    def number(self):
        number = [self.center, self.s, self.e, self.w, self.n, self.back]
        return number

    def move(self,str):
        if str == 'N':
            x = self.n
            self.n = self.center
            self.center = self.s
            self.s = self.back
            self.back = x
            return self.center
        elif str == 'S':
            x = self.s
            self.s = self.center
            self.center = self.n
            self.n = self.back
            self.back = x
            return self.center
        elif str== 'E':
            x = self.e
            self.e = self.center
            self.center = self.w
            self.w = self.back
            self.back = x
            return self.center
        elif str == 'W':
            x = self.w
            self.w = self.center
            self.center = self.e
            self.e = self.back
            self.back = x
            return self.center

dice1 = Dice(n1)
dice2 = Dice(n2)
bool = False
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
        break
    dice1.move('N')
    for j in range(4):
        if dice1.number() == dice2.number():
            bool = True
            break
        dice1.move('E')



dice1 = Dice(n1)
dice2 = Dice(n2)
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
        break
    dice1.move('E')
    for j in range(4):
        if dice1.number() == dice2.number():
            bool = True
            break
        dice1.move('N')


print('Yes') if bool == True else print('No')

Submission status: Wrong Answer

Solution code:
n1 = [int(i) for i in input().split()]
n2 = [int(i) for i in input().split()]


class Dice(object):
    def __init__(self,num):
        self.n = num[4]
        self.e = num[2]
        self.w = num[3]
        self.s = num[1]
        self.center = num[0]
        self.back = num[5]

    def number(self):
        number = [self.center, self.s, self.e, self.w, self.n, self.back]
        return number

    def move(self,str):
        if str == 'N':
            x = self.n
            self.n = self.center
            self.center = self.s
            self.s = self.back
            self.back = x
            return self.center
        elif str == 'S':
            x = self.s
            self.s = self.center
            self.center = self.n
            self.n = self.back
            self.back = x
            return self.center
        elif str== 'E':
            x = self.e
            self.e = self.center
            self.center = self.w
            self.w = self.back
            self.back = x
            return self.center
        elif str == 'W':
            x = self.w
            self.w = self.center
            self.center = self.e
            self.e = self.back
            self.back = x
            return self.center

dice1 = Dice(n1)
dice2 = Dice(n2)
bool = False
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
    for j in range(4):
        # print(dice1.number())
        if dice1.number() == dice2.number():
            bool = True
        dice1.move('E')
    dice1.move('N')



dice1 = Dice(n1)
dice2 = Dice(n2)
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
    for j in range(4):
        if dice1.number() == dice2.number():
            bool = True
        dice1.move('N')
    dice1.move('E')

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
    else:
        dice1.move('N')
        if dice1.number() == dice2.number():
            bool = True
    dice1.move('E')


print('Yes') if bool == True else print('No')

Submission status: Wrong Answer

Solution code:
n1 = [int(i) for i in input().split()]
n2 = [int(i) for i in input().split()]


class Dice(object):
    def __init__(self,num):
        self.n = num[4]
        self.e = num[2]
        self.w = num[3]
        self.s = num[1]
        self.center = num[0]
        self.back = num[5]

    def number(self):
        number = [self.center, self.s, self.e, self.w, self.n, self.back]
        return number

    def move(self,str):
        if str == 'N':
            x = self.n
            self.n = self.center
            self.center = self.s
            self.s = self.back
            self.back = x
            return self.center
        elif str == 'S':
            x = self.s
            self.s = self.center
            self.center = self.n
            self.n = self.back
            self.back = x
            return self.center
        elif str== 'E':
            x = self.e
            self.e = self.center
            self.center = self.w
            self.w = self.back
            self.back = x
            return self.center
        elif str == 'W':
            x = self.w
            self.w = self.center
            self.center = self.e
            self.e = self.back
            self.back = x
            return self.center

dice1 = Dice(n1)
dice2 = Dice(n2)
bool = False
status = dice1.center

for i in range(3):
    if dice1.number() == dice2.number():
        bool = True
    for j in range(3):
        # print(dice1.number())
        dice1.move('E')
        if dice1.number() == dice2.number():
            bool = True
    dice1.move('N')



dice1 = Dice(n1)
dice2 = Dice(n2)
status = dice1.center

for i in range(3):
    if dice1.number() == dice2.number():
        bool = True
    for j in range(3):
        dice1.move('N')
        if dice1.number() == dice2.number():
            bool = True
    dice1.move('E')



print('Yes') if bool == True else print('No')

Submission status: Wrong Answer

Solution code:
n1 = [int(i) for i in input().split()]
n2 = [int(i) for i in input().split()]


class Dice(object):
    def __init__(self,num):
        self.n = num[4]
        self.e = num[2]
        self.w = num[3]
        self.s = num[1]
        self.center = num[0]
        self.back = num[5]

    def number(self):
        number = [self.center, self.s, self.e, self.w, self.n, self.back]
        return number

    def move(self,str):
        if str == 'N':
            x = self.n
            self.n = self.center
            self.center = self.s
            self.s = self.back
            self.back = x
            return self.center
        elif str == 'S':
            x = self.s
            self.s = self.center
            self.center = self.n
            self.n = self.back
            self.back = x
            return self.center
        elif str== 'E':
            x = self.e
            self.e = self.center
            self.center = self.w
            self.w = self.back
            self.back = x
            return self.center
        elif str == 'W':
            x = self.w
            self.w = self.center
            self.center = self.e
            self.e = self.back
            self.back = x
            return self.center

dice1 = Dice(n1)
dice2 = Dice(n2)
bool = False
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
    for j in range(4):
        # print(dice1.number())
        dice1.move('E')
        if dice1.number() == dice2.number():
            bool = True
    dice1.move('N')



dice1 = Dice(n1)
dice2 = Dice(n2)
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
    for j in range(4):
        dice1.move('N')
        if dice1.number() == dice2.number():
            bool = True
    dice1.move('E')



print('Yes') if bool == True else print('No')

Submission status: Wrong Answer

Solution code:
n1 = [int(i) for i in input().split()]
n2 = [int(i) for i in input().split()]


class Dice(object):
    def __init__(self,num):
        self.n = num[4]
        self.e = num[2]
        self.w = num[3]
        self.s = num[1]
        self.center = num[0]
        self.back = num[5]

    def number(self):
        number = [self.center, self.s, self.e, self.w, self.n, self.back]
        return number

    def move(self,str):
        if str == 'N':
            x = self.n
            self.n = self.center
            self.center = self.s
            self.s = self.back
            self.back = x
            return self.center
        elif str == 'S':
            x = self.s
            self.s = self.center
            self.center = self.n
            self.n = self.back
            self.back = x
            return self.center
        elif str== 'E':
            x = self.e
            self.e = self.center
            self.center = self.w
            self.w = self.back
            self.back = x
            return self.center
        elif str == 'W':
            x = self.w
            self.w = self.center
            self.center = self.e
            self.e = self.back
            self.back = x
            return self.center

dice1 = Dice(n1)
dice2 = Dice(n2)
bool = False
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
    for j in range(3):
        # print(dice1.number())
        dice1.move('E')
        if dice1.number() == dice2.number():
            bool = True
    dice1.move('N')



dice1 = Dice(n1)
dice2 = Dice(n2)
status = dice1.center

for i in range(4):
    if dice1.number() == dice2.number():
        bool = True
    for j in range(3):
        dice1.move('N')
        if dice1.number() == dice2.number():
            bool = True
    dice1.move('E')



print('Yes') if bool == True else print('No')