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.

Constraints

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

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.

Examples

Input

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


Output

Yes


Input

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


Output

No
class Dice:
  def __init__(self, state):
    self.state = state

  def vertical(self, direction):
    s = self.state
    state = [s[1], s[5], s[0], s[4]]
    if direction < 0:
      s[0], s[1], s[4], s[5] = state
    elif 0 < direction:
      s[0], s[1], s[4], s[5] = reversed(state)
    return self
  
  def lateral(self, direction):
    s = self.state
    state = [s[2], s[5], s[0], s[3]]
    if direction < 0:
      s[0], s[2], s[3], s[5] = state
    elif 0 < direction:
      s[0], s[2], s[3], s[5] = reversed(state)
    return self

  def north(self):
    self.vertical(-1)
    return self

  def south(self):
    self.vertical(1)
    return self
  
  def east(self):
    self.lateral(1)
    return self

  def west(self):
    self.lateral(-1)
    return self

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

if dice1.state == dice2.state:
  print('Yes')
else:
  is_eql = False
  for c in list('NNNNWNNNWNNNENNNENNNWNNN'):       
    if c == 'N':
      dice1.north()
    elif c == 'S':
      dice1.south()
    elif c == 'W':
      dice1.west()
    elif c == 'E':
      dice1.east()
    if dice1.state == dice2.state:
      is_eql = True
      break
  print('Yes' if is_eql else 'No')
      
  
