Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Dice III

  Write a program which reads the two dices constructed in the same way as Dice I, and determines whether these two dices are identical. You can roll a dice in the same way as Dice I, and if all integers observed from the six directions are the same as that of another dice, these dices can be considered as identical.

Input

  In the first line, six integers assigned to faces of a dice are given in ascending order of their corresponding labels.

    In the second line, six integers assigned to faces of another dice are given in ascending order of their corresponding labels.

Output

  Print "Yes" if two dices are identical, otherwise "No" in a line.

Constraints

$0 \leq $ the integer assigned to a face $ \leq 100$

Sample Input 1

1 2 3 4 5 6
6 2 4 3 5 1

Sample Output 1

Yes

Sample Input 2

1 2 3 4 5 6
6 5 4 3 2 1

Sample Output 2

No



Sample input:
1 2 3 4 5 6
6 2 4 3 5 1


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
#coding:utf-8
#1_11_C 2015.4.20
class Dice:
    def __init__(self,ary):
        self.top , self.south , self.east , self.west , self.north ,self.bottom = ary

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

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

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

dice1 = Dice(input().split())
dice2 = Dice(input().split())

for i in range(3):
    if dice1.top == dice2.top or dice1.south == dice2.south:
        break
    dice1.roll_n()

for j in range(3):
    if dice1.top == dice2.top and dice1.south == dice2.south:
        break
    elif dice1.top == dice2.top:
        dice1.twist()
    elif dice1.south == dice2.south:
        dice1.roll_e()

if dice1.top == dice2.top and dice1.north == dice2.north and dice1.south == dice2.south and dice1.east == dice2.east and dice1.west == dice2.west and dice1.bottom == dice2.bottom:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#coding:utf-8
#1_11_C 2015.4.26
class Dice:
    def __init__(self,ary):
        self.top , self.south , self.east , self.west , self.north ,self.bottom = ary

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

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

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

dice1 = Dice(list(input().split()))
dice2 = Dice(list(input().split()))

i = 0

while dice1.top != dice2.top or dice1.south != dice2.south:
    if i > 8:
        break

    if dice1.top == dice2.top:
        dice1.twist()
    elif dice1.south == dice2.south:
        dice1.roll_e()
    else:
        dice1.roll_n()

    i += 1

if dice1.top == dice2.top and dice1.north == dice2.north and dice1.south == dice2.south and dice1.east == dice2.east and dice1.west == dice2.west and dice1.bottom == dice2.bottom:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys
import io
import re
import math
import itertools
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.141592653589
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
#start = time.clock()
ans=chk=0
a=[0,2,5,3]
b=[0,1,5,4]

def rolling(word,dice):
    if word=='S':
        dice[0],dice[1],dice[5],dice[4]=dice[4],dice[0],dice[1],dice[5]
    elif word=='N':
        dice[0],dice[1],dice[5],dice[4]=dice[1],dice[5],dice[4],dice[0]
    elif word=='W':
        dice[0],dice[2],dice[5],dice[3]=dice[2],dice[5],dice[3],dice[0]
    else:
        dice[0],dice[2],dice[5],dice[3]=dice[3],dice[0],dice[2],dice[5]
    return dice

def sortdice(dice1,dice2,p):
    for i in range(4):
        dice1[p[0]],dice1[p[1]],dice1[p[2]],dice1[p[3]]=dice1[p[1]],dice1[p[2]],dice1[p[3]],dice1[p[0]]
        if dice1==dice2:
            print 'Yes'
            exit()
    return 0

l1=map(int,raw_input().split())
l2=map(int,raw_input().split())
sortdice(l1,l2,a)
sortdice(l1,l2,b)
print 'No'

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys
import io
import re
import math
import itertools
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.141592653589
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
#start = time.clock()
ans=chk=0
a=[0,2,5,3]
b=[0,1,5,4]

def rolling(word,dice):
    if word=='S':
        dice[0],dice[1],dice[5],dice[4]=dice[4],dice[0],dice[1],dice[5]
    elif word=='N':
        dice[0],dice[1],dice[5],dice[4]=dice[1],dice[5],dice[4],dice[0]
    elif word=='W':
        dice[0],dice[2],dice[5],dice[3]=dice[2],dice[5],dice[3],dice[0]
    else:
        dice[0],dice[2],dice[5],dice[3]=dice[3],dice[0],dice[2],dice[5]
    return dice

def sortdice(dice1,dice2,p,q):
    for i in range(4):
        dice1[p[0]],dice1[p[1]],dice1[p[2]],dice1[p[3]]=dice1[p[1]],dice1[p[2]],dice1[p[3]],dice1[p[0]]
        for j in range(4):
            dice1[q[0]],dice1[q[1]],dice1[q[2]],dice1[q[3]]=dice1[q[1]],dice1[q[2]],dice1[q[3]],dice1[q[0]]
            if dice1==dice2:
                print 'Yes'
                exit()
    return 0

l1=map(int,raw_input().split())
l2=map(int,raw_input().split())
sortdice(l1,l2,a,b)
print 'No'

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys
import io
import re
import math
import itertools
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.141592653589
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
#start = time.clock()
ans=chk=0
a=[0,2,5,3]
b=[0,1,5,4]

def rolling(word,dice):
    if word=='S':
        dice[0],dice[1],dice[5],dice[4]=dice[4],dice[0],dice[1],dice[5]
    elif word=='N':
        dice[0],dice[1],dice[5],dice[4]=dice[1],dice[5],dice[4],dice[0]
    elif word=='W':
        dice[0],dice[2],dice[5],dice[3]=dice[2],dice[5],dice[3],dice[0]
    else:
        dice[0],dice[2],dice[5],dice[3]=dice[3],dice[0],dice[2],dice[5]
    return dice

def sortdice(dice1,dice2,p,q):
    for i in range(5):
        dice1[p[0]],dice1[p[1]],dice1[p[2]],dice1[p[3]]=dice1[p[1]],dice1[p[2]],dice1[p[3]],dice1[p[0]]
        for j in range(5):
            dice1[q[0]],dice1[q[1]],dice1[q[2]],dice1[q[3]]=dice1[q[1]],dice1[q[2]],dice1[q[3]],dice1[q[0]]
            if dice1==dice2:
                print 'Yes'
                exit()
    return 0

l1=map(int,raw_input().split())
l2=map(int,raw_input().split())
sortdice(l1,l2,a,b)
print 'No'

Submission status: Wrong Answer

Solution code:
print 'Yes'

Submission status: Wrong Answer

Solution code:
#coding:utf-8
#1_11_C

class Dice:
    def __init__(self, ary):
        self.top, self.south, self.east, self.west, self.north, self.bottom = ary

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

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

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

    def isEqual(self, dice):
        if self.top == dice.top and self.south == dice.south and self.east == dice.east and self.west == dice.west and self.north == dice.north and self.bottom == dice.bottom:
            return True
        else:
            return False

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

flag = False

for i in range(6):
    if i%2 == 0:
        dice1.roll_n()
    else:
        dice1.roll_e()

    for j in range(4):
        if dice1.isEqual(dice2):
            flag = True
        else:
            dice1.twist

    if flag:
        break

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

Submission status: Wrong Answer

Solution code:
class Dice:

    def __init__(self, faces):
        self.faces = tuple(faces)

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

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

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

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

    def number(self, face_id):
        return self.faces[face_id - 1]

    def check_equals(self, other_dice):
        for i in range(4):
            for j in range(4):
                if self.faces == other_dice.faces:
                    return True
                other_dice.roll_north()
            other_dice.roll_west()
        return False

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

print("Yes" if dice1.check_equals(dice2) else "No")

Submission status: Wrong Answer

Solution code:
class Dice:

    def __init__(self, faces):
        self.faces = tuple(faces)

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

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

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

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

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

    def number(self, face_id):
        return self.faces[face_id - 1]

    def issame(self, other_dice):
        for i in range(4):
            for j in range(4):
                if self.faces == other_dice.faces:
                    return True
                self.rotate()
            self.roll_north()
        for i in range(4):
            for j in range(4):
                if self.faces == other_dice.faces:
                    return True
                self.rotate()
            self.roll_east()
        return False

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

print("Yes" if dice1.issame(dice2) else "No")

Submission status: Wrong Answer

Solution code:
class Dice:

    def __init__(self, faces):
        self.faces = tuple(faces)

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

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

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

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

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

    def issame(self, other_dice):
        for i in range(4):
            if self.faces[0] == other_dice.faces[0]:
                for j in range(4):
                    if self.faces == other_dice.faces:
                        return True
                    self.rotate()
            self.roll_north()

        for i in range(4):
            if self.faces[0] == other_dice.faces[0]:
                for j in range(4):
                    if self.faces == other_dice.faces:
                        return True
                    self.rotate()
            self.roll_east()
        return False

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

print("Yes" if dice1.issame(dice2) else "No")

Submission status: Wrong Answer

Solution code:
class Dice:

    def __init__(self, faces):
        self.faces = tuple(faces)

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

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

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

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

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

    def issame(self, other_dice):
        for i in range(4):
            if self.faces[0] == other_dice.faces[0]:
                for j in range(4):
                    if self.faces == other_dice.faces:
                        return True
                    self.rotate()
            self.roll_north()

        for i in range(4):
            if self.faces[0] == other_dice.faces[0]:
                for j in range(4):
                    if self.faces == other_dice.faces:
                        return True
                    self.rotate()
            self.roll_east()
        return False

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

print("Yes" if dice1.issame(dice2) else "No")

Submission status: Wrong Answer

Solution code:
import random

class Dice:
  def __init__(self, list = map(str, range(1, 7))):
    self.top = list[0]
    self.front = list[1]
    self.right = list[2]
    self.left = list[3]
    self.back = list[4]
    self.bottom = list[5]

    self.dic = {}
    for i in xrange(6):
      if list[i] in self.dic:
        self.dic[list[i]] += 1
      else:
        self.dic[list[i]] = 1

  def print_all(self):
    print "top = " + self.top + ", front = " + self.front + ", right = " + self.right + ", left = " + self.left + ", back = " + self.back + ", bottom = " + self.bottom

  def roll_N(self):
    temp = self.top
    self.top = self.front
    self.front = self.bottom
    self.bottom = self.back
    self.back = temp

  def roll_S(self):
    temp = self.top
    self.top = self.back
    self.back = self.bottom
    self.bottom = self.front
    self.front = temp

  def roll_W(self):
    temp = self.top
    self.top = self.right
    self.right = self.bottom
    self.bottom = self.left
    self.left = temp

  def roll_E(self):
    temp = self.top
    self.top = self.left
    self.left = self.bottom
    self.bottom = self.right
    self.right = temp

  def roll_C(self):
    temp = self.front
    self.front = self.right
    self.right = self.back
    self.back = self.left
    self.left = temp

  def random_roll(self):
    ram = random.randint(1, 4)
    if ram == 1:
      self.roll_E()
    elif ram == 2:
      self.roll_N()
    elif ram == 3:
      self.roll_S()
    else:
      self.roll_W()

  def getDifference(self, dice):
    same_list = []
    different_list = []
    if self.top == dice.top:
      same_list.append("top")
    else:
      different_list.append("top")
    if self.front == dice.front:
      same_list.append("front")
    else:
      different_list.append("front")
    if self.left == dice.left:
      same_list.append("left")
    else:
      different_list.append("left")
    if self.back == dice.back:
      same_list.append("back")
    else:
      different_list.append("back")
    if self.right == dice.right:
      same_list.append("right")
    else:
      different_list.append("right")
    if self.bottom == dice.bottom:
      same_list.append("bottom")
    else:
      different_list.append("bottom")

    result_list = [same_list, different_list]
    return result_list

  def getList(self):
    list = [self.top, self.front, self.right, self.left, self.back, self.bottom]
    return list

first_dice = Dice(raw_input().split(" "))
second_dice = Dice(raw_input().split(" "))

def print_dices():
  print "first dice: "
  first_dice.print_all()
  print "second dice: "
  second_dice.print_all()

line = "#######################################"

num = 0
debug = 0
while num < 4:
  # debug += 1
  # if debug > 10:
  #   break
  # print line

  dic1_keys = first_dice.dic.keys()
  for i in xrange(len(dic1_keys)):
    if first_dice.dic[dic1_keys[i]] != second_dice.dic[dic1_keys[i]]:
      num = 4
      break

  # print_dices()

  diferece = first_dice.getDifference(second_dice)
  # print diferece

  if len(diferece[0]) == 6:
    break

  if "front" in diferece[0] or "back" in diferece[0]:
    first_dice.roll_W()
    num += 1
  elif "left" in diferece[0] or "right" in diferece[0]:
    first_dice.roll_S()
    num += 1
  elif "top" in diferece[0] or "bottom" in diferece[0]:
    first_dice.roll_C()
    num += 1
  else:
    first_dice.random_roll()

if num == 4:
  print "No"
else:
  print "Yes"

Submission status: Wrong Answer

Solution code:
class Dice(object):

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

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

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

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

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

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

dice1 = Dice(map(int, raw_input().split()))
dice2 = Dice(map(int, raw_input().split()))
yes_flg = False
if len(set(dice1.num) - set(dice2.num)) != 0:
    print 'No'
else:
    num = 0
    for i in range(6):
        if dice1.num[0] == dice2.num[i]:
            num = i
            break
    if num == 1:
        dice2.rotate_N()
    elif num == 2:
        dice2.rotate_W()
    elif num == 3:
        dice2.rotate_E()
    elif num == 4:
        dice2.rotate_S()
    elif num == 5:
        dice2.rotate_S()
        dice2.rotate_S()

    if (dice1.num[0] + dice1.num[5]) == (dice2.num[0] + dice2.num[5]):
        for i in range(3):
            if (dice1.num[1] == dice2.num[1]) & (dice1.num[2] == dice2.num[2]) & (dice1.num[3] == dice2.num[3]):
                yes_flg = True
                break
            dice1.rotate_M()

    if yes_flg:
        print 'Yes'
    else:
        print 'No'

Submission status: Wrong Answer

Solution code:
class Dice(object):

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

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

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

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

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

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

dice1 = Dice(map(int, raw_input().split()))
dice2 = Dice(map(int, raw_input().split()))
yes_flg = False
if len(set(dice1.num) - set(dice2.num)) != 0:
    print 'No'
else:
    num = []
    for i in range(6):
        if dice1.num[0] == dice2.num[i]:
            num.append(i)
    for j in num:
        if j == 1:
            dice2.rotate_N()
        elif j == 2:
            dice2.rotate_W()
        elif j == 3:
            dice2.rotate_E()
        elif j == 4:
            dice2.rotate_S()
        elif j == 5:
            dice2.rotate_S()
            dice2.rotate_S()

        if dice1.num[5] == dice2.num[5]:
            for i in range(3):
                if (dice1.num[1] == dice2.num[1]) & (dice1.num[2] == dice2.num[2]) & (dice1.num[3] == dice2.num[3]):
                    yes_flg = True
                    break
                dice1.rotate_M()
            if yes_flg:
                break
    if yes_flg:
        print 'Yes'
    else:
        print 'No'

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, num_tuple):
        self.faces = num_tuple

    def find_rf(self, top, front):
        tf = str(self.faces.index(top)) + str(self.faces.index(front))
        if tf in '12431':
            return self.faces[0]
        elif tf in '03520':
            return self.faces[1]
        elif tf in '01540':
            return self.faces[2]
        elif tf in '04510':
            return self.faces[3]
        elif tf in '02530':
            return self.faces[4]
        else:
            return self.faces[5]

    def is_same(self, dice):
        for i in self.faces:
            if not i in dice.faces:
                return 'No'
        top1 = self.faces[0]
        front1 = self.faces[1]
        top2 = self.faces[4]
        front2 = self.faces[5]
        if (self.find_rf(top1, front1) == dice.find_rf(top1, front1)):
            if (self.find_rf(top2, front2) == dice.find_rf(top2, front2)):
                return 'Yes'
        else:
            return 'No'

num_tuple1 = tuple(map(int, input().split()))
num_tuple2 = tuple(map(int, input().split()))

dice1 = Dice(num_tuple1)
dice2 = Dice(num_tuple2)

ans = dice1.is_same(dice2)

print(ans)

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, num_tuple):
        self.faces = num_tuple

    def find_rf(self, top, front):
        tf = str(self.faces.index(top)) + str(self.faces.index(front))
        if tf in '12431':
            return self.faces[0]
        elif tf in '03520':
            return self.faces[1]
        elif tf in '01540':
            return self.faces[2]
        elif tf in '04510':
            return self.faces[3]
        elif tf in '02530':
            return self.faces[4]
        else:
            return self.faces[5]

    def is_same(self, dice):
        for i in self.faces:
            if not i in dice.faces:
                return 'No'
        top1 = self.faces[3]
        front1 = self.faces[1]
        top2 = self.faces[0]
        front2 = self.faces[3]
        top3 = self.faces[0]
        front3 = self.faces[1]
        top4 = self.faces[4]
        front4 = self.faces[5]
        top5 = self.faces[0]
        front5 = self.faces[2]
        top6 = self.faces[2]
        front6 = self.faces[1]
        if (self.find_rf(top1, front1) == dice.find_rf(top1, front1)):
            if (self.find_rf(top2, front2) == dice.find_rf(top2, front2)):
                if (self.find_rf(top3, front3) == dice.find_rf(top3, front3)):
                    if (self.find_rf(top4, front4) == dice.find_rf(top4, front4)):
                        if (self.find_rf(top5, front5) == dice.find_rf(top5, front5)):
                            if (self.find_rf(top6, front6) == dice.find_rf(top6, front6)):
                                return 'Yes'
        return 'No'

num_tuple1 = tuple(map(int, input().split()))
num_tuple2 = tuple(map(int, input().split()))

dice1 = Dice(num_tuple1)
dice2 = Dice(num_tuple2)

ans = dice1.is_same(dice2)

print(ans)

Submission status: Wrong Answer

Solution code:
class Dice:
    same_dice_index = ('135246', '142536', '154326',
                       '214365', '231645', '246135', '263415',
                       '312564', '326154', '351624', '365214',
                       '415263', '421653', '456123', '462513',
                       '513462', '536142', '541632', '564312',
                       '624351', '632541', '645231', '653421')

    def __init__(self, num_list):
        self.faces = num_list

    def is_same(self, dice):
        for i in Dice.same_dice_index:
            example_faces = []
            for j in i:
                example_faces.append(self.faces[int(j) - 1])
            if example_faces == dice.faces:
                return 'Yes'
        return 'No'

num_list1 = list(map(int, input().split()))
num_list2 = list(map(int, input().split()))

dice1 = Dice(num_list1)
dice2 = Dice(num_list2)

ans = dice1.is_same(dice2)

print(ans)

Submission status: Wrong Answer

Solution code:
class Dice(object):
    def __init__(self, top, south, east, west, north, bottom):
        self.top = top
        self.south = south
        self.east = east
        self.west = west
        self.north = north
        self.bottom = bottom
 
    def get_face(self, face):
        if face == 'top':
            return self.top
        elif face == 'south':
            return self.south
        elif face == 'east':
            return self.east
        elif face == 'west':
            return self.west
        elif face == 'north':
            return self.north
        elif face == 'bottom':
            return self.bottom
 
    def rotate(self, directions):
        for direction in directions:
            if direction == 'S':
                self.prev_top = self.top
                self.top = self.north
                self.north = self.bottom
                self.bottom = self.south
                self.south = self.prev_top
            elif direction == 'E':
                self.prev_top = self.top
                self.top = self.west
                self.west = self.bottom
                self.bottom = self.east
                self.east = self.prev_top
            elif direction == 'W':
                self.prev_top = self.top
                self.top = self.east
                self.east = self.bottom
                self.bottom = self.west
                self.west = self.prev_top
            elif direction == 'N':
                self.prev_top = self.top
                self.top = self.south
                self.south = self.bottom
                self.bottom = self.north
                self.north = self.prev_top
 
dice1 = Dice(*map(int,input().split()))
dice2 = Dice(*map(int,input().split()))

# find the same top face
for direction in 'NNNEEE':
    if dice1.get_face('top') == dice2.get_face('top'):
        break
    dice1.rotate(direction)
 
# find south face
for directions in ['NES']*3:
    if dice1.get_face('south') == dice2.get_face('south'):
        break
    for direction in directions:
        dice1.rotate(direction)

if dice1.get_face('east') == dice2.get_face('east'):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
class Dice(object):
    def __init__(self, top, south, east, west, north, bottom):
        self.top = top
        self.south = south
        self.east = east
        self.west = west
        self.north = north
        self.bottom = bottom
 
    def get_face(self, face):
        if face == 'top':
            return self.top
        elif face == 'south':
            return self.south
        elif face == 'east':
            return self.east
        elif face == 'west':
            return self.west
        elif face == 'north':
            return self.north
        elif face == 'bottom':
            return self.bottom
 
    def rotate(self, directions):
        for direction in directions:
            if direction == 'S':
                self.prev_top = self.top
                self.top = self.north
                self.north = self.bottom
                self.bottom = self.south
                self.south = self.prev_top
            elif direction == 'E':
                self.prev_top = self.top
                self.top = self.west
                self.west = self.bottom
                self.bottom = self.east
                self.east = self.prev_top
            elif direction == 'W':
                self.prev_top = self.top
                self.top = self.east
                self.east = self.bottom
                self.bottom = self.west
                self.west = self.prev_top
            elif direction == 'N':
                self.prev_top = self.top
                self.top = self.south
                self.south = self.bottom
                self.bottom = self.north
                self.north = self.prev_top
 
dice1 = Dice(*map(int,input().split()))
dice2 = Dice(*map(int,input().split()))

# find the same top face
for direction in 'NNNEEE':
    if dice1.get_face('top') == dice2.get_face('top'):
        break
    dice1.rotate(direction)
 
# find south face
for directions in ['NES']*3:
    if dice1.get_face('south') == dice2.get_face('south'):
        break
    for direction in directions:
        dice1.rotate(direction)

if dice1.get_face('east') == dice2.get_face('east') and \
   dice1.get_face('west') == dice2.get_face('west') and \
   dice1.get_face('north') == dice2.get_face('north') and \
   dice1.get_face('bottom') == dice2.get_face('bottom'):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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