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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

class Dice {
    int top;
    int bottom;
    int left;
    int right;
    int front;
    int back;

    static Dice of (int[] init) {
        Dice d = new Dice();
        // [top front right left back bottom]
        d.top = init[0];
        d.bottom = init[5];
        d.left = init[3];
        d.right = init[2];
        d.front = init[1];
        d.back = init[4];
        return d;
    }

    static Dice of (Dice copy) {
        Dice d = new Dice();
        d.top = copy.top;
        d.bottom = copy.bottom;
        d.left = copy.left;
        d.right = copy.right;
        d.front = copy.front;
        d.back = copy.back;
        return d;
    }

    int[] toArray () {
        int[] arr = new int[6];
        arr[0] = top;
        arr[1] = front;
        arr[2] = right;
        arr[3] = left;
        arr[4] = back;
        arr[5] = bottom;
        return arr;
    }

    // roll to right
    void E () {
        Dice copy = Dice.of(this);
        top = copy.left;
        bottom = copy.right;
        left = copy.bottom;
        right = copy.top;
    }

    // roll to back
    void N () {
        Dice c = Dice.of(this);
        top = c.front;
        bottom = c.back;
        front = c.bottom;
        back = c.top;
    }

    // roll to front
    void S () {
        Dice c = Dice.of(this);
        top = c.back;
        bottom = c.front;
        front = c.top;
        back = c.bottom;
    }

    // roll to left
    void W () {
        Dice c = Dice.of(this);
        top = c.right;
        bottom = c.left;
        left = c.top;
        right = c.bottom;
    }

    void toTop (int n) {
        if (n == bottom) {
            E();
            E();
        } else if (n == left) {
            E();
        } else if (n == right) {
            W();
        } else if (n == front) {
            N();
        } else if (n == back) {
            S();
        }
    }

    void toFront (int n) {
        if (n == top) {
            S();
        } else if (n == bottom) {
            N();
        } else if (n == left) {
            E();
            S();
        } else if (n == right) {
            W();
            S();
        } else if (n == back) {
            S();
            S();
        }
    }
}

public class Main {
    public static void main(String[] args) {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
            String allPattern = "EEENEEENEEESEEESEEENEEEN";
            int[] arr1 = Arrays.stream(in.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            int[] arr2 = Arrays.stream(in.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            Dice dice2 = Dice.of(arr2);

            boolean isSame = Arrays.equals(arr1, arr2);
            for (int i = 0; i < allPattern.length(); i++) {
                if (isSame) break;
                switch (allPattern.charAt(i)) {
                    case 'E':
                        dice2.E();
                        break;
                    case 'N':
                        dice2.N();
                        break;
                    case 'S':
                        dice2.S();
                        break;
                    case 'W':
                        dice2.W();
                        break;
                }
                isSame = Arrays.equals(arr1, dice2.toArray());
            }

            if (isSame) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

