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

class Main {
	 
	public static void main(String[] args) {
		
		Scanner cin=new Scanner(System.in);
		boolean jd=false;
		
		//dice1 init
		Dice dice1=new Dice();
		for(int i=0;i<6;i++) {
			dice1.SurfaceNum[i]=cin.nextInt();
		}
		
		//dice2 init
		Dice dice2=new Dice();
		for(int i=0;i<6;i++) {
			dice2.SurfaceNum[i]=cin.nextInt();
		}
		
		for(int i=0;i<6;i++) {
			
			dice1.findTop(dice1.SurfaceNum[i]);
			
			//System.out.println(i);
			
			if(!dice2.findTop(dice1.SurfaceNum[dice1.gridX[0]-1])) {
				System.out.println("No1");
				continue;
			}
			
			if(dice2.adjustBehind(dice1.SurfaceNum[dice1.gridY[3]-1])) {
				
				int c=0;
				
				for(int j=1;j<4;j++) {
					if(dice1.SurfaceNum[dice1.gridX[j]-1]==dice2.SurfaceNum[dice2.gridX[j]-1]) c++;
				}
				
				if(c==3 && dice1.SurfaceNum[dice1.gridY[1]-1]==dice2.SurfaceNum[dice2.gridY[1]-1]) jd=true;
				//System.out.println(c);
			}
			if(jd)break;
		}
		
		if(jd)System.out.println("Yes");
		else System.out.println("No");
	}
	

}


class Dice {
	int SurfaceNum[]=new int[6];
	
	int gridX[]= {1,3,6,4},gridY[]= {1,5,6,2};
	
	int temp=1,temp2=1,i=0,move=0;
	
	void rotateDice(char odr) {
		if(odr=='N') {
			temp=gridY[3];
			System.arraycopy(gridY, 0, gridY, 1, gridY.length-1);
			gridY[0]=temp;
			gridX[0]=gridY[0];
			gridX[2]=gridY[2];
		}
		else if(odr=='S') {
			temp=gridY[0];
			System.arraycopy(gridY, 1, gridY, 0, gridY.length-1);
			gridY[3]=temp;
			gridX[0]=gridY[0];
			gridX[2]=gridY[2];
		}
		else if(odr=='E') {
			temp=gridX[3];
			System.arraycopy(gridX, 0, gridX, 1, gridX.length-1);
			gridX[0]=temp;
			gridY[0]=gridX[0];
			gridY[2]=gridX[2];
		}
		else if(odr=='W') {
			temp=gridX[0];
			System.arraycopy(gridX, 1, gridX, 0, gridX.length-1);
			gridX[3]=temp;
			gridY[0]=gridX[0];
			gridY[2]=gridX[2];
		}
		
		else if(odr=='L') {
			temp=gridX[1]; gridX[1]=gridY[3];
			temp2=gridY[1]; gridY[1]=temp;
			temp=gridX[3]; gridX[3]=temp2;
			gridY[3]=temp;
		}
		
		else if(odr=='R') {
			temp=gridX[3]; gridX[3]=gridY[3];
			temp2=gridY[1]; gridY[1]=temp;
			temp=gridX[1]; gridX[1]=temp2;
			gridY[3]=temp;
		}
	}
	
	boolean adjustBehind(int a) {
		move=0;
		
		if(SurfaceNum[gridX[1]-1]==a)move=1;
		else if(SurfaceNum[gridY[1]-1]==a)move=2;
		else if(SurfaceNum[gridX[3]-1]==a)move=3;
		else if(SurfaceNum[gridY[3]-1]==a)move=0;
		else move=-1;
		
		if(move>=0) {
			for(i=0;i<move;i++) rotateDice('R');
			return true;
		}
		else return false;
	}
	
	void findRight(int top,int bhd) {
		
		findTop(top);
		/*for(i=0;i<4;i++) System.out.print(SurfaceNum[gridX[i]-1]+" ");
		System.out.println();
		for(i=0;i<4;i++) System.out.print(SurfaceNum[gridY[i]-1]+" ");
		System.out.println();*/
		
		if(SurfaceNum[gridX[1]-1]==bhd)System.out.println(SurfaceNum[gridY[1]-1]);
		else if(SurfaceNum[gridX[3]-1]==bhd)System.out.println(SurfaceNum[gridY[3]-1]);
		else if(SurfaceNum[gridY[1]-1]==bhd)System.out.println(SurfaceNum[gridX[3]-1]);
		else if(SurfaceNum[gridY[3]-1]==bhd)System.out.println(SurfaceNum[gridX[1]-1]);
		else System.out.println("ERROR");
	}
	
	boolean findTop(int top) {
		move=0;
		
		if(top!=SurfaceNum[gridX[0]-1]) {
			for(i=1;i<4;i++) {
				if(SurfaceNum[gridX[i]-1]==top)move=i;
			}
			
			if(move!=0) {
				for(i=0;i<move;i++) rotateDice('W');
			}
			else {
				if(SurfaceNum[gridY[1]-1]==top) rotateDice('S');
				else if(SurfaceNum[gridY[3]-1]==top)rotateDice('N');
				else return false;
			}
		}
		else if(top==SurfaceNum[gridX[0]-1]) return true;
		
		return true;
	}
	

}
