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;
public class Main {
    public static final int DICE_NUM = 6;
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	String[] input = scan.nextLine().split(" ");
	String[] input2 = scan.nextLine().split(" ");
	int[] face1 = new int[6];
	int[] face2 = new int[6];
	for (int i = 0; i < 6; i++) {
	    face1[i] = Integer.parseInt(input[i]);
	    face2[i] = Integer.parseInt(input2[i]);
	}
	Dice dice1 = new Dice(face1);
	Dice dice2 = new Dice(face2);
	if (dice1.checkSameDice(dice2)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
}
class Dice{
    int NORTH = 4;
    int SOUTH = 1;
    int WEST = 3;
    int EAST = 2;
    int TOP = 0;
    int BOTTOM = 5;
    int[] face = new int[6];
	
    Dice(int[] face){
	this.face = face;
    }

    void setFront(int front){
	while(face[SOUTH] != front){
	    turnRight();
	}
    }
    
    void setTop(int top, int bottom){
	int cnt = 0;
	while((face[TOP] != top || face[BOTTOM] != bottom) && cnt < 4){
	    turnSouth();
	    cnt++;
	}
	cnt = 0;
	while((face[TOP] != top || face[BOTTOM] != bottom) && cnt < 4){
	    turnEast();
	    cnt++;
	}
    }

    void turnRight(){
	turnEast();
	turnSouth();
	turnWest();
    }

    void turnEast(){
	int bottom = face[BOTTOM];
	int west = face[WEST];
	face[BOTTOM] = face[EAST];
	face[EAST] = face[TOP];
	face[WEST] = bottom;
	face[TOP] = west;
    }

    void turnWest(){
	int bottom = face[BOTTOM];
	int east = face[EAST];
	face[BOTTOM] = face[WEST];
	face[WEST] = face[TOP];
	face[EAST] = bottom;
	face[TOP] = east;
    }
	
    void turnNorth(){
	int bottom = face[BOTTOM];
	int south = face[SOUTH];
	face[BOTTOM] = face[NORTH];
	face[NORTH] = face[TOP];
	face[SOUTH] = bottom;
	face[TOP] = south;
    }

    void turnSouth(){
	int bottom = face[BOTTOM];
	int north = face[NORTH];
	face[BOTTOM] = face[SOUTH];
	face[SOUTH] = face[TOP];
	face[NORTH] = bottom;
	face[TOP] = north;
    }
    
    int getFace(int index){
	return face[index];
    }

    int getFront(){
	return face[SOUTH];
    }
    
    int getTop() {
	return getFace(TOP);
    }

    boolean checkSameDice(Dice dice2){
	int top1 = getTop();
	int bottom1 = getFace(BOTTOM);
	dice2.setTop(top1, bottom1);
	int[] side1 = new int[8];
	int[] side2 = new int[4];
	for (int i = 0; i < 4; i++) {
	    side1[i] = getFront();
	    side1[i+4]  = getFront();
	    side2[i] = dice2.getFront();
	    turnRight();
	    dice2.turnRight();
	}
	for (int i = 0; i < 4; i++) {
	    if (side1[0+i] == side2[0] && side1[1+i] == side2[1] && side1[2+i] == side2[2] && side1[3+i] == side2[3]) {
		return true;
	    }
	}
	return false;
    }
}
    