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;

class Main {

	public static void main(String[] args) {

		final char[] checkall = { 'N', 'N', 'N', 'N', 'W', 'W', 'W' };

		Scanner stdIn = new Scanner(System.in);

		Dice dice1 = createDice(stdIn);
		Dice dice2 = createDice(stdIn);

		alignment(dice1, dice2, checkall);


		if (0 <= dice1.getLine().indexOf(dice2.getLine().substring(0, (dice2.getLine().length() / 2)))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		stdIn.close();
	}

	private static Dice createDice(Scanner stdIn) {
		int[] sary = new int[6];
		for (int i = 0; i < sary.length; i++) {
			sary[i] = stdIn.nextInt();
		}
		stdIn.nextLine();
		Dice d = new Dice(sary[0], sary[1], sary[2], sary[3], sary[4], sary[5]);
		return d;
	}

	private static void alignment(Dice dice1, Dice dice2, char[] checkall) {
		for (int i = 0; i < checkall.length; i++) {
			dice2.roll(checkall[i]);
			if (dice1.getTop() == dice2.getTop() && dice1.getBottom() == dice2.getBottom()) {
				break;
			}
		}
	}
}

class Dice {
	private int top;
	private int front;
	private int right;
	private int left;
	private int back;
	private int bottom;

	int temp;

	public Dice(int top, int front, int right, int left, int back, int bottom) {
		super();
		this.top = top;
		this.front = front;
		this.right = right;
		this.left = left;
		this.back = back;
		this.bottom = bottom;
	}

	public void rollPattern(String rollpattern) {
		for (int i = 0; i < rollpattern.length(); i++) {
			roll(rollpattern.charAt(i));
			System.out.println(rollpattern.charAt(i) + " " + " " + getTop());
		}
	}

	public void roll(char x) {
		switch (x) {
		case 'N':
			rollNorth();
			break;
		case 'S':
			rollSorth();
			break;
		case 'W':
			rollWest();
			break;
		case 'E':
			rollEast();
			break;
		default:
			System.exit(1);
			break;
		}
	}

	private void rollNorth() {
		temp = top;
		top = front;
		front = bottom;
		bottom = back;
		back = temp;
	}

	private void rollSorth() {
		temp = top;
		top = back;
		back = bottom;
		bottom = front;
		front = temp;
	}

	private void rollWest() {
		temp = top;
		top = right;
		right = bottom;
		bottom = left;
		left = temp;
	}

	private void rollEast() {
		temp = top;
		top = left;
		left = bottom;
		bottom = right;
		right = temp;
	}

	public int getTop() {
		return top;
	}

	public int getBottom() {
		return bottom;
	}

	public StringBuilder getLine() {
		int[] ary = { front, right, back, left, front, right, back, left };
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < ary.length; i++) {
			sb.append(ary[i]);
		}
		return sb;
	}
}