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.util.Scanner;
 
 
/**
 * @author kawakami
 *
 */
class Main {
 
    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner as = new Scanner(System.in);
         
        int diceO[][];
        int diceC[][];
        int n = 0;
        int num1,num2;
        String str = "";
        Boolean breakp = null;
         
        //n = as.nextInt();
         
        diceO = new int[2][6];
        diceC = new int[2][6];
         
        for(int i=0;i<2;i++){
            for(int j=0;j<6;j++){
                 
                diceO[i][j] = as.nextInt();
                 
            }
        }
        diceC = diceO;
        num1 = 0;
        num2 = 1;
         
        breakp = Spin.DoubleCheck(diceO, diceC, num1, num2);
         
        if(breakp){
             
            str = "Yes";
             
        }
        else{
             
            str = "No";
             
        }
         
         
        System.out.println(str);
 
    }
 
}
 
class Spin{
     
    public static int[][] diceSpin(int[][] dice,String spn,int num2) {
     
        int tre = 0;    
             
        switch (spn){
        case "x":
            tre = dice[num2][4];
            dice[num2][4] = dice[num2][0];
            dice[num2][0] = dice[num2][1];
            dice[num2][1] = dice[num2][5];
            dice[num2][5] = tre;
            break;
             
        case "y":
            tre = dice[num2][3];
            dice[num2][3] = dice[num2][0];
            dice[num2][0] = dice[num2][2];
            dice[num2][2] = dice[num2][5];
            dice[num2][5] = tre;
            break;
             
        case "z":
            tre = dice[num2][2];
            dice[num2][2] = dice[num2][1];
            dice[num2][1] = dice[num2][3];
            dice[num2][3] = dice[num2][4];
            dice[num2][4] = tre;
            break;
                     
        }
             
        return dice;
         
      }
     
    public static Boolean Samecheck(int[][] dice1,int[][] dice2,int num1,int num2){
         
        Boolean flag = null;
         
        for(int i=0;i<6;i++){
             
            if(dice1[num1][i] != dice2[num2][i]){
                 
                flag = false;
                break;
            }
            else{
                 
                flag = true;
                 
            }
             
        }
         
        return flag;
         
    }
     
    public static Boolean Check(int[][] dice1,int[][] dice2,int sp,int num1,int num2){
         
        Boolean flag = null;
        String spn = null;
         
        switch (sp){
        case 0:
            spn = "x";
            break;
             
        case 1:
            spn = "y";
            break;
             
        case 2:
            spn = "z";
            break;
             
        }
         
        for(int j=0;j<4;j++){        
             
            dice2 = Spin.diceSpin(dice2, spn,num2);
            if(Spin.Samecheck(dice1, dice2,num1,num2)){
                 
                flag = true;
                break;
             
            }
             
            flag = false;
             
        }
         
        return flag;
         
    }
     
    public static Boolean DoubleCheck(int[][] dice1,int[][] dice2,int num1,int num2){
         
        Boolean breakp = null;
         
        for(int i=0;i<3;i++){
             
            for (int j=0;j<4;j++){
                 
                for(int k=0; k<j; k++){
                     
                    dice2 = Spin.diceSpin(dice2, "x",num2);
                     
                }
                 
                breakp = Spin.Check(dice1, dice2, i,num1,num2);
                 
                if(breakp == true){
                     
                    break;
                     
                }
                 
            }
             
            if(breakp == true){
                 
                break;
                 
            }
         
        }
         
        return breakp;
         
    }
     
}