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 java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Dice dice1 = new Dice(br.readLine().split(" "));
        Dice dice2 = new Dice(br.readLine().split(" "));

        int topFace = dice2.getFace(0);
        int frontFace = dice2.getFace(1);
        int i;
        outside: for (i = 0; i < 6; i++) {
            if (dice1.getFace(i) == topFace) {
                dice1.setTopFace(topFace);

                for (i = 1; i < 5; i++) {
                    if (dice1.getFace(i) == frontFace) {
                        dice1.setFrontFace(frontFace);

                        for (i = 2; i < 6; i++) {
                            if (dice1.getFace(i) != dice2.getFace(i)) {
                                break outside;
                            }
                        }

                        System.out.println("Yes");
                        return;
                    }
                }

                break;
            }
        }

        System.out.println("No");
    }
}

class Dice {
    private int[] dice = new int[6];

    Dice (String[] num) {
        for (int i = 0; i < 6; i++) {
            dice[i] = Integer.parseInt(num[i]);
        }
    }

    public void roll (char direction) {
        int temp;
        switch (direction) {
            case 'N':
            temp = dice[0];
            dice[0] = dice[1];
            dice[1] = dice[5];
            dice[5] = dice[4];
            dice[4] = temp;
            break;

            case 'S':
            temp = dice[0];
            dice[0] = dice[4];
            dice[4] = dice[5];
            dice[5] = dice[1];
            dice[1] = temp;
            break;

            case 'E':
            temp = dice[0];
            dice[0] = dice[3];
            dice[3] = dice[5];
            dice[5] = dice[2];
            dice[2] = temp;
            break;

            case 'W':
            temp = dice[0];
            dice[0] = dice[2];
            dice[2] = dice[5];
            dice[5] = dice[3];
            dice[3] = temp;
            break;
        }
    }

    public int getFace (int num) {
        return dice[num];
    }

    public void setTopFace (int top) {
        if (top == dice[1]) {
            this.roll('N');
        } else if (top == dice[2]) {
            this.roll('W');
        } else if (top == dice[3]) {
            this.roll('E');
        } else if (top == dice[4]) {
            this.roll('S');
        } else if (top == dice[5]) {
            this.roll('N');
            this.roll('N');
        }
    }

    public void setFrontFace (int front) {
        int temp;
        if (front == dice[2]) {
            temp = dice[1];
            dice[1] = dice[2];
            dice[2] = dice[4];
            dice[4] = dice[3];
            dice[3] = temp;
        } else if (front == dice[3]) {
            temp = dice[1];
            dice[1] = dice[3];
            dice[3] = dice[4];
            dice[4] = dice[2];
            dice[2] = temp;
        } else if (front == dice[4]) {
            temp = dice[1];
            dice[1] = dice[4];
            dice[4] = temp;
            temp = dice[2];
            dice[2] = dice[3];
            dice[3] = temp;
        }
    }
}