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 void main(String[] args) {
		int i;
		int[] diceA = new int[6];
		int[] diceB = new int[6];
		Dice d = new Dice();
		try (Scanner sc = new Scanner(System.in)) {
			for(i = 0; i < 6; i++) {
				d.dice_make(i, sc.nextInt()); //diceの作成
				diceA[i] = d.getDice(i);
			}
			for(i = 0; i < 6; i++) {
				d.dice_make(i, sc.nextInt()); //diceの作成
				diceB[i] = d.getDice(i);
			}
			if(d.compare(diceA, diceB)) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
	}
}
class Dice{
	private int[] dice = new int[6];
	public void dice_make(int i, int dice_spot){
		dice[i] = dice_spot;
	}
	public void rotation(String direction) {
		switch(direction) {
		case "E": dice = new int[] {dice[3],dice[1],dice[0],dice[5],dice[4],dice[2]};break;
		case "N": dice = new int[] {dice[1],dice[5],dice[2],dice[3],dice[0],dice[4]};break;
		case "S": dice = new int[] {dice[4],dice[0],dice[2],dice[3],dice[5],dice[1]};break;
		case "W": dice = new int[] {dice[2],dice[1],dice[5],dice[0],dice[4],dice[3]};break;
		case "T": dice = new int[] {dice[0],dice[3],dice[1],dice[4],dice[2],dice[5]};break;
		default : dice = new int[] {};break;
		}
	}
	public boolean same(int a, int b) {
		int i = 0;
		for(i = 0; i < 6; i++) {
			if(i % 2 == 0) {
				rotation("E");
			}else {
				rotation("N");
			}
			if(dice[0] == a) {
				for(i = 0; i < 4; i++) {
					rotation("T");
					if(dice[1] == b) {
						return true;
					}
				}
			}
		}
		return false;
	}
	public boolean compare(int[] diceA, int[] diceB) {
		int i, counter = 0;
		dice = diceA;
		if(same(diceB[0], diceB[1])) {
			for(i = 0; i < 6; i++) {
				if(dice[i] == diceB[i]) {
					counter++;
				}
			}
			if(counter == 6) {
				return true;
			}
		}
		return false;
	}
	public int getDice(int i) {
		return dice[i];
	}
	public int[] getDice_array() {
		return dice;
	}
}
