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, list1):
    self.f = list1
  def spin1(self):#(真上から見て反時計回り)
    self.f[0], self.f[1], self.f[4], self.f[5] = self.f[1], self.f[5], self.f[0], self.f[4]
    self.f[0], self.f[2], self.f[3], self.f[5] = self.f[3], self.f[0], self.f[5], self.f[2]
    self.f[0], self.f[1], self.f[4], self.f[5] = self.f[4], self.f[0], self.f[5], self.f[1]
    return self.f
  def spin2(self):#(方角Eから見て時計回り)
    self.f[0], self.f[1], self.f[4], self.f[5] = self.f[1], self.f[5], self.f[0], self.f[4]
    return self.f
  def spin3(self):#(方角Sから見て半時計回り)
    self.f[0], self.f[2], self.f[3], self.f[5] = self.f[2], self.f[5], self.f[0], self.f[3]
    return self.f

data = list(map(int, input().split()))
data_1 = list(map(int, input().split()))
data_2 = []
data_3 = []
data_4 = []
dice_1 = Dice(data)
for i in range(0, 4):
    a = dice_1.spin2()
    b = a[:]
    data_2.append(b)

for j in data_2:
    dice_2 = Dice(j)
    for k in range(0, 4):
        c = dice_2.spin1()
        d = c[:]
        data_3.append(d)
data_5 = data_2 + data_3

for l in data_5:
    dice_3 = Dice(l)
    for m in range(0, 4):
        e = dice_3.spin3()
        f = e[:]
        data_4.append(f)

if data_1 in data_4:
    print("Yes")
else:
    print("No")
