output_description: Print "Yes" if two dices are identical, otherwise "No" in a line.
input_description: 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.
attempt: # coding: utf-8
  import copy
  
  
  class Dice:
  
      def __init__(self, d):
          self.data = {
              "bottom": d[5],
              "north": d[4],
              "west": d[3],
              "east": d[2],
              "south": d[1],
              "top": d[0],
          }
  
      def moveOne(self, direction):
          if direction == "W":
              temp = self.data["bottom"]
              self.data["bottom"] = self.data["west"]
              self.data["west"] = self.data["top"]
              self.data["top"] = self.data["east"]
              self.data["east"] = temp
          elif direction == "E":
              temp = self.data["bottom"]
              self.data["bottom"] = self.data["east"]
              self.data["east"] = self.data["top"]
              self.data["top"] = self.data["west"]
              self.data["west"] = temp
          elif direction == "N":
              temp = self.data["bottom"]
              self.data["bottom"] = self.data["north"]
              self.data["north"] = self.data["top"]
              self.data["top"] = self.data["south"]
              self.data["south"] = temp
          elif direction == "S":
              temp = self.data["bottom"]
              self.data["bottom"] = self.data["south"]
              self.data["south"] = self.data["top"]
              self.data["top"] = self.data["north"]
              self.data["north"] = temp
  
      def movePart(self, directions):
          for direction in directions:
              self.moveOne(direction)
  
      def setDiceII(self, a, b):
          if self.data["east"] == a:
              self.moveOne("W")
          elif self.data["north"] == a:
              self.moveOne("S")
          elif self.data["west"] == a:
              self.moveOne("E")
          elif self.data["south"] == a:
              self.moveOne("N")
          elif self.data["bottom"] == a:
              self.movePart("WW")
  
          if self.data["north"] == b:
              self.rotateRight()
              self.rotateRight()
          elif self.data["east"] == b:
              self.rotateRight()
          elif self.data["west"] == b:
              self.rotateLeft()
  
          # self.printDice()
  
      def rotateRight(self):
          temp = self.data["east"]
          self.data["east"] = self.data["north"]
          self.data["north"] = self.data["west"]
          self.data["west"] = self.data["south"]
          self.data["south"] = temp
  
      def rotateLeft(self):
          temp = self.data["west"]
          self.data["west"] = self.data["north"]
          self.data["north"] = self.data["east"]
          self.data["east"] = self.data["south"]
          self.data["south"] = temp
  
      def getSurface(self):
          return self.data["top"]
  
      def getEast(self):
          return self.data["east"]
  
      def getData(self):
          return self.data
  
      def getPatterns(self):
          patterns = []
          for i in range(4):
              tempi = copy.copy(self.getData())
              for ip in range(i):
                  self.moveOne("N")
              for j in range(4):
                  tempj = copy.copy(self.getData())
                  for jp in range(j):
                      self.moveOne("E")
                  patterns.append(copy.copy(self.getData()))
                  self.data = tempj
              self.data = tempi
          self.rotateRight()
          for i in range(4):
              tempi = copy.copy(self.getData())
              for ip in range(i):
                  self.moveOne("N")
              for j in range(4):
                  tempj = copy.copy(self.getData())
                  for jp in range(j):
                      self.moveOne("E")
                  patterns.append(copy.copy(self.getData()))
                  self.data = tempj
              self.data = tempi
          return patterns
  
      def printDice(self):
          print(self.data["north"])
          print(
              str(self.data["west"])
              + " "
              + str(self.data["bottom"])
              + " "
              + str(self.data["east"])
          )
          print(self.data["south"])
          print(self.data["top"])
  
  
  num1 = list(map(int, input().rstrip().split()))
  num2 = list(map(int, input().rstrip().split()))
  dice1 = Dice(num1)
  dice2 = Dice(num2)
  flag = False
  for i in dice2.getPatterns():
      if dice1.getData() == i:
          print("Yes")
          flag = True
          break
  if not flag:
      print("No")
  
problem_description: 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.
samples: [{"input": "1 2 3 4 5 6\n    6 2 4 3 5 1", "output": "Yes"}, {"input": "1 2 3 4 5 6\n    6 5 4 3 2 1", "output": "No"}]