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 Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		Dice d1=new Dice(br.readLine().split(" "));
		Dice d2=new Dice(br.readLine().split(" "));
		boolean match=false;
		for(int i=0;i<6;i++){
			for(int j=0;j<4;j++){
				d2.spinR();
				if(d1.match(d2)){
					match=true;
					break;
				}
			}
			if(match) break;
			if(i%2==0){
				d2.throwN();
			}else{
				d2.throwW();
			}
			if(d1.match(d2)){
				match=true;
				break;
			}
		}
		if(match){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
	
	static class Dice {
		private String top,front,right,left,back,bottom;

		public Dice(String[] lbl){
			top=lbl[0];
			front=lbl[1];
			right=lbl[2];
			left=lbl[3];
			back=lbl[4];
			bottom=lbl[5];
		}
		
		public void throwN(){ String tmp=top; top=front; front=bottom; bottom=back; back=tmp; }
		public void throwS(){ String tmp=top; top=back; back=bottom; bottom=front; front=tmp; }
		public void throwE(){ String tmp=top; top=left; left=bottom; bottom=right; right=tmp; }
		public void throwW(){ String tmp=top; top=right; right=bottom; bottom=left; left=tmp; }
		public void spinR(){ String tmp=front; front=left; left=back; back=right; right=tmp; }

		public String getTop() { return top; }
		public String getFront() { return front; }
		public String getRight() { return right; }
		public String getLeft() { return left; }
		public String getBack() { return back; }
		public String getBottom() { return bottom; }
		
		public boolean match(Dice dice2){
			if(this.getTop().equals(dice2.getTop())&&this.getFront().equals(dice2.getFront())
					&&this.getRight().equals(dice2.getRight())&&this.getLeft().equals(dice2.getLeft())
					&&this.getBack().equals(dice2.getBack())&&this.getBottom().equals(dice2.getBottom())){
				return true;
			}else{
				return false;
			}
		}
	}
}