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):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        is_same_rows = self.__is_same_set(self.dice1.rows, self.dice2.rows)
        is_same_cols = self.__is_same_set(self.dice1.cols, self.dice2.cols)
        
        if is_same_rows and is_same_cols: 
            self.__find_num(self.dice1_top, self.dice2)
            if self.dice1_front not in self.dice2.rows:
                self.dice2.move_prev_cols()  
                self.__find_num(self.dice1_front, self.dice2)
            
            while self.dice1_top != self.dice2.rows[0]:
                self.dice2.move_next_rows()
            
            is_same_rows = self.dice1.rows == self.dice2.rows
            is_same_cols = self.dice1.cols == self.dice2.cols
            if is_same_rows and is_same_cols: 
                print("Yes")
            else:
                self.__rot(self.dice2)
                is_same_rows = self.dice1.rows == self.dice2.rows
                is_same_cols = self.dice1.cols == self.dice2.cols
            
                if is_same_rows and is_same_cols: 
                    print("Yes")
                else:
                    print("No")

        else:
            print("No")  
        
    def __find_num(self, x, dice):
        i = 0
        while x != dice.rows[0]:
            dice.move_next_rows()
            if i > 3:
                dice.move_next_cols()
                i = 0
            i+=1
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.rows[3]
        dice.rows[3] = temp

        temp = dice.cols[1]
        dice.cols[1] = dice.cols[3]
        dice.cols[3] = temp

    def __is_same_set(self, x, y):
        return set(x) == set(y)
        
d1 = list(map(int, input().split(" ")))
d2 = list(map(int, input().split(" ")))
dice1 = Dice(d1)
dice2 = Dice(d2)

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        # self.__find_num(self.dice1_top, self.dice2)
        # if self.dice1_front not in self.dice2.rows:
        #     self.dice2.move_prev_cols()  
        #     self.__find_num(self.dice1_front, self.dice2)
        
        # while self.dice1_top != self.dice2.rows[0]:
        #     self.dice2.move_next_rows()
        is_same = False
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                self.__rot(self.dice2)
                is_rot_same = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                
                if is_same_element or is_rot_same: 
                    is_same = True
                else:
                    is_same = False
                self.dice2.move_next_cols()     
            self.dice2.move_next_rows()
        
        if is_same:
            print("Yes")
        else:
            print("No")
    def __find_num(self, x, dice):
        i = 0
        while x != dice.rows[0]:
            dice.move_next_rows()
            if i > 3:
                dice.move_next_cols()
                i = 0
            i+=1
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.rows[3]
        dice.rows[3] = temp

        temp = dice.cols[1]
        dice.cols[1] = dice.cols[3]
        dice.cols[3] = temp

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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        self.__find_num(self.dice1_top, self.dice2)
        if self.dice1_front not in self.dice2.rows:
            self.dice2.move_prev_cols()  
            self.__find_num(self.dice1_front, self.dice2)
        
        while self.dice1_top != self.dice2.rows[0]:
            self.dice2.move_next_rows()
        is_same = False
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                self.__rot(self.dice2)
                is_rot_same = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                
                if is_same_element or is_rot_same: 
                    is_same = True
                else:
                    is_same = False
                self.dice2.move_next_cols()     
            self.dice2.move_next_rows()
        
        if is_same:
            print("Yes")
        else:
            print("No")
    def __find_num(self, x, dice):
        i = 0
        while x != dice.rows[0]:
            dice.move_next_rows()
            if i > 3:
                dice.move_next_cols()
                i = 0
            i+=1
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.rows[3]
        dice.rows[3] = temp

        temp = dice.cols[1]
        dice.cols[1] = dice.cols[3]
        dice.cols[3] = temp

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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        # self.__find_num(self.dice1_top, self.dice2)
        # if self.dice1_front not in self.dice2.rows:
        #     self.dice2.move_prev_cols()  
        #     self.__find_num(self.dice1_front, self.dice2)
        #     while self.dice1_top != self.dice2.rows[0]:
        #         self.dice2.move_next_rows()
        print(self.dice1.rows)
        print(self.dice1.cols)
        is_same = False
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                self.__rot(self.dice2)
                is_rot_same = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                
                if is_same_element or is_rot_same: 
                    is_same = True
                    break
                self.dice2.move_next_cols()
                
                print(self.dice2.rows)

            else:     
                self.dice2.move_next_rows()
                continue
            break
        if is_same:
            print("Yes")
        else:
            print("No")
    
    def __find_num(self, x, dice):
        i = 0
        while x != dice.rows[0]:
            dice.move_next_rows()
            if i > 3:
                dice.move_next_cols()
                i = 0
            i+=1
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.rows[3]
        dice.rows[3] = temp

        temp = dice.cols[1]
        dice.cols[1] = dice.cols[3]
        dice.cols[3] = temp

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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        # self.__find_num(self.dice1_top, self.dice2)
        # if self.dice1_front not in self.dice2.rows:
        #     self.dice2.move_prev_cols()  
        #     self.__find_num(self.dice1_front, self.dice2)
        #     while self.dice1_top != self.dice2.rows[0]:
        #         self.dice2.move_next_rows()
        is_same = False
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                self.__rot(self.dice2)
                is_rot_same = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                
                if is_same_element or is_rot_same: 
                    is_same = True
                    break
                self.dice2.move_next_cols()
                
                print(self.dice2.rows)

            else:     
                self.dice2.move_next_rows()
                continue
            break
        if is_same:
            print("Yes")
        else:
            print("No")
    
    def __find_num(self, x, dice):
        i = 0
        while x != dice.rows[0]:
            dice.move_next_rows()
            if i > 3:
                dice.move_next_cols()
                i = 0
            i+=1
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.rows[3]
        dice.rows[3] = temp

        temp = dice.cols[1]
        dice.cols[1] = dice.cols[3]
        dice.cols[3] = temp

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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        is_same = False
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                self.__rot(self.dice2)
                is_rot_same = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                
                if is_same_element or is_rot_same: 
                    is_same = True
                    break
                self.dice2.move_next_cols()
            else:     
                self.dice2.move_next_rows()
                continue
            break
        if is_same:
            print("Yes")
        else:
            print("No")
    
    def __find_num(self, x, dice):
        i = 0
        while x != dice.rows[0]:
            dice.move_next_rows()
            if i > 3:
                dice.move_next_cols()
                i = 0
            i+=1
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.rows[3]
        dice.rows[3] = temp

        temp = dice.cols[1]
        dice.cols[1] = dice.cols[3]
        dice.cols[3] = temp

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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        is_same = False
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                if is_same_element:
                    is_same = True
                    break
                self.dice2.move_next_cols()
            else:     
                self.dice2.move_next_rows()
                continue
            break
        if is_same:
            print("Yes")
        else:
            print("No")

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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):
        print(self.dice1.rows)
        print(self.dice1.cols)
        print("-------------------")
        is_same = False
        i = 0
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                print(self.dice2.rows)
                print(self.dice2.cols)
                if is_same_element:
                    is_same = True
                    break
                i += 1
                print(i)
                self.dice2.move_next_rows()
            else:     
                self.dice2.move_next_cols()
                continue
            break
        if is_same:
            print("Yes")
        else:
            print("No")

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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        is_same = False
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                if is_same_element: 
                    is_same = True
                    break
                self.__rot(self.dice2)
            else:     
                self.dice2.move_next_rows()
                continue
            break
        if is_same:
            print("Yes")
        else:
            print("No")
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.cols[3]
        dice.cols[3] = dice.rows[3]
        dice.rows[3] = dice.cols[1]
        dice.cols[1] = temp

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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        is_same = False
        for _ in range(2):
            for _ in range(2):
                for _ in range(4):
                    is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                    if is_same_element: 
                        is_same = True
                    self.__rot(self.dice2)
                self.dice2.move_next_rows()
            self.dice2.move_next_cols()
            
        if is_same:
            print("Yes")
        else:
            print("No")
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.cols[3]
        dice.cols[3] = dice.rows[3]
        dice.rows[3] = dice.cols[1]
        dice.cols[1] = temp



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

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()

Submission status: Wrong Answer

Solution code:
class Daise:
    def __init__(self, info_list):
        self.T = info_list[0]
        self.S = info_list[1]
        self.E = info_list[2]
        self.W = info_list[3]
        self.N = info_list[4]
        self.B = info_list[5]
    
    def change(self, axis):
        if axis == 'S':
            self.T, self.B, self.S, self.N = self.N, self.S, self.T, self.B
        
        elif axis == 'E':
            self.T, self.B, self.E, self.W = self.W, self.E, self.T, self.B
        
        elif axis == 'W':
            self.T, self.B, self.W, self.E = self.E, self.W, self.T, self.B
        
        elif axis == 'N':
            self.T, self.B, self.N, self.S = self.S, self.N, self.T, self.B
        
        elif axis == 'Turn':
            self.S, self.E, self.N, self.W = self.E, self.N, self.W, self.S
    
    def output(self):
        return [self.T, self.S, self.E, self.W, self.N, self.B]


if __name__ == '__main__':
    daiseA = Daise(list(map(str, input().split())))
    daiseB = Daise(list(map(str, input().split())))
    
    n = 0
    while daiseA.T != daiseB.T and n < 100:
        daiseB.change('S')
        daiseB.change('S')
        daiseB.change('Turn')
        n += 1
    
    while daiseA.S != daiseB.S and n < 100:
        daiseB.change('Turn')
        n += 1
    
    if daiseA.output() == daiseB.output():
        print("Yes")
    else: 
        print('No')

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, dice: list):
        self.top = dice[0]
        self.bottom = dice[5]
        self.front = dice[1]
        self.behind = dice[4]
        self.right = dice[2]
        self.left = dice[3]

    def __eq__(self, other):
        if not isinstance(other, Dice):
            return NotImplemented
        return self.top == other.top and self.bottom == other.bottom and self.front == other.front \
                and self.behind == other.behind and self.right == other.right

    def roll(self, direction: str):
        buffer = self.top
        if direction == 'E':
            self.top = self.left
            self.left = self.bottom
            self.bottom = self.right
            self.right = buffer
        elif direction == 'N':
            self.top = self.front
            self.front = self.bottom
            self.bottom = self.behind
            self.behind = buffer
        elif direction == 'S':
            self.top = self.behind
            self.behind = self.bottom
            self.bottom = self.front
            self.front = buffer
        else:
            self.top = self.right
            self.right = self.bottom
            self.bottom = self.left
            self.left = buffer

    def turn(self):
        buffer = self.front
        self.front = self.right
        self.right = self.behind
        self.behind = self.left
        self.left = buffer


def main():
    dices = [list(map(int, input().split())) for _ in range(2)]
    for i in dices[0]:
        if not dices[1].__contains__(i):
            print('No')
            return
    dice1, dice2 = [Dice(dice) for dice in dices]
    for _ in range(3):
        if not [dice2.right, dice2.left].__contains__(dice1.top):
            break
        dice2.turn()
    while dice1.top != dice2.top:
        dice2.roll('N')
    for _ in range(3):
        if dice1 == dice2:
            print('Yes')
            return
        dice2.turn()
    print('No')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, dice: list):
        self.top = dice[0]
        self.bottom = dice[5]
        self.front = dice[1]
        self.behind = dice[4]
        self.right = dice[2]
        self.left = dice[3]

    def __eq__(self, other):
        if not isinstance(other, Dice):
            return NotImplemented
        return self.top == other.top and self.bottom == other.bottom and self.front == other.front \
                and self.behind == other.behind and self.right == other.right

    def roll(self, direction: str):
        buffer = self.top
        if direction == 'E':
            self.top = self.left
            self.left = self.bottom
            self.bottom = self.right
            self.right = buffer
        elif direction == 'N':
            self.top = self.front
            self.front = self.bottom
            self.bottom = self.behind
            self.behind = buffer
        elif direction == 'S':
            self.top = self.behind
            self.behind = self.bottom
            self.bottom = self.front
            self.front = buffer
        else:
            self.top = self.right
            self.right = self.bottom
            self.bottom = self.left
            self.left = buffer

    def turn(self):
        buffer = self.front
        self.front = self.right
        self.right = self.behind
        self.behind = self.left
        self.left = buffer


def main():
    dice1, dice2 = [Dice(list(map(int, input().split()))) for _ in range(2)]
    for _ in range(4):
        for _ in range(4):
            if dice1 == dice2:
                print('Yes')
                return
            dice2.turn()
        dice2.roll('N')
    print('No')


if __name__ == '__main__':
    main()