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
import random
class Dice:
    def __init__(self, top, dside, rside, lside, uside, bottom):
        self.top = top
        self.dside = dside
        self.rside = rside
        self.lside = lside
        self.uside = uside
        self.bottom = bottom
    def north(self):
        (self.top, self.dside, self.bottom, self.uside) = (self.dside, 
            self.bottom, self.uside, self.top)
    def east(self):
        (self.top, self.lside, self.bottom, self.rside) = (self.lside,
            self.bottom, self.rside, self.top)
    def south(self):
        (self.top, self.dside, self.bottom, self.uside) = (self.uside, 
            self.top, self.dside, self.bottom)

num1 = list(map(int, input().split()))
num2 = list(map(int, input().split()))
dice1 = Dice(num1[0], num1[1], num1[2], num1[3], num1[4], num1[5])
dice2 = Dice(num2[0], num2[1], num2[2], num2[3], num2[4], num2[5])
if len(set(num1))<4:
    while(dice1.top!=dice2.top or dice1.rside!=dice2.rside
          or dice1.dside!=dice2.dside):
        mode = random.randint(0, 2)
        if mode==0: 
            dice2.north()
        elif mode==1: 
            dice2.east()
        else: 
            dice2.south()
else:
    while dice1.top!=dice2.top or dice1.rside!=dice2.rside:
        mode = random.randint(0, 2)
        if mode==0: 
            dice2.north()
        elif mode==1: 
            dice2.east()
        else: 
            dice2.south()
if dice1.bottom==dice2.bottom and dice1.lside==dice2.lside:
    if dice1.dside==dice2.dside: 
        print("Yes")
    else: 
        print("No")
else:
    print("No")

