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 IOException{
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);

        Dice[] dice = new Dice[2];
        dice[0] = new Dice(br.readLine());
        dice[1] = new Dice(br.readLine());
        if(Compare.compare(dice[0],dice[1]) )System.out.println("Yes");
        else System.out.println("No");
    }
}


class Dice {
    public int[] plane = new int[6];
    int tmp = -1;

    public Dice(String all){
        String name[] = all.split(" ");
        for (int i=0; i<6; ++i) {
            plane[i] = Integer.parseInt(name[i]);
        }
    }

    public void east(){
      tmp = plane[0];
      plane[0] = plane[3];
      plane[3] = plane[5];
      plane[5] = plane[2];
      plane[2] = tmp;
    }

    public void north(){
      tmp = plane[0];
      plane[0] = plane[1];
      plane[1] = plane[5];
      plane[5] = plane[4];
      plane[4] = tmp;
    }

    public void south(){
      tmp = plane[0];
      plane[0] = plane[4];
      plane[4] = plane[5];
      plane[5] = plane[1];
      plane[1] = tmp;
    }

    public void west(){
      tmp = plane[0];
      plane[0] = plane[2];
      plane[2] = plane[5];
      plane[5] = plane[3];
      plane[3] = tmp;
    }

    public void spin(){
      tmp = plane[1];
      plane[1] = plane[2];
      plane[2] = plane[4];
      plane[4] = plane[3];
      plane[3] = tmp;
    }

}

class Compare {
    public static boolean compare(Dice d1, Dice d2){
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.west();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.east();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.north();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.west();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.west();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }

        return false;
    }
    public static boolean check(Dice d1, Dice d2){
        if(d1.plane[0] == d2.plane[0] && d1.plane[1] == d2.plane[1] && d1.plane[2] == d2.plane[2] && d1.plane[3] == d2.plane[3] && d1.plane[4] == d2.plane[4] && d1.plane[5] == d2.plane[5]){
                return true;
            }
            return false;
        }
}