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) {
		Scanner sc = new Scanner(System.in);
		int num1[] = new int[6];
		for (int i = 0; i < 6; i++) {
			num1[i] = sc.nextInt();
		}
		Dice d1 = new Dice(num1);

		int num2[] = new int[6];
		for (int i = 0; i < 6; i++) {
			num2[i] = sc.nextInt();
		}
		Dice d2 = new Dice(num2);

		if (isEqualDice(d1, d2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	static boolean isEqualDice(Dice d1, Dice d2) {
		while (true) {
			if (d1.num[0] == d2.num[0]) {
				break;
			}
			if (d1.num[0] == d2.num[1]) {
				d2.rollNorth();
			} else if (d1.num[0] == d2.num[2]) {
				d2.rollWest();
			} else if (d1.num[0] == d2.num[3]) {
				d2.rollEast();
			} else if (d1.num[0] == d2.num[4]) {
				d2.rollSouth();
			} else if (d1.num[0] == d2.num[5]) {
				d2.rollSouth();
				d2.rollSouth();
			} else {
				return false;
			}
		}

		while (true) {
			if (d1.num[1] == d2.num[1]) {
				break;
			}
			if (d1.num[1] == d2.num[2]) {
				d2.rollLeft();
			} else if (d1.num[1] == d2.num[3]) {
				d2.rollRight();
			} else if (d1.num[1] == d2.num[4]) {
				d2.rollRight();
				d2.rollRight();
			} else {
				return false;
			}
		}

		if (d1.num[2] == d2.num[2]) {
			return true;
		} else {
			return false;
		}
	}
}

class Dice {
	int num[];
	int temp;

	public Dice(int num[]) {
		this.num = num;
	}

	void printDice() {

		for (int i = 0; i < 6; i++) {
			System.out.print(num[i] + " ");
		}
		System.out.println();
	}

	void printDiceSide(int upSide, int frontSide) {
		while (true) {
			if (upSide == num[0] && frontSide == num[1]) {
				break;
			}

			if (upSide == num[1]) {
				rollSouth();
			} else if (upSide == num[2]) {
				rollEast();
			} else if (upSide == num[3]) {
				rollWest();
			} else if (upSide == num[4]) {
				rollNorth();
			} else if (upSide == num[5]) {
				rollSouth();
				rollSouth();
			}
			if (frontSide == num[2]) {
				rollRight();
			} else if (frontSide == num[3]) {
				rollLeft();
			} else if (frontSide == num[4]) {
				rollRight();
				rollRight();
			}
		}
		System.out.println(num[2]);
	}

	void rollWest() {
		temp = num[0];
		num[0] = num[2];
		num[2] = num[5];
		num[5] = num[3];
		num[3] = temp;
	}

	void rollNorth() {
		temp = num[0];
		num[0] = num[1];
		num[1] = num[5];
		num[5] = num[4];
		num[4] = temp;
	}

	void rollEast() {
		temp = num[0];
		num[0] = num[3];
		num[3] = num[5];
		num[5] = num[2];
		num[2] = temp;
	}

	void rollSouth() {
		temp = num[0];
		num[0] = num[4];
		num[4] = num[5];
		num[5] = num[1];
		num[1] = temp;
	}

	void rollRight() {
		temp = num[1];
		num[1] = num[3];
		num[3] = num[4];
		num[4] = num[2];
		num[2] = temp;
	}

	void rollLeft() {
		temp = num[1];
		num[1] = num[2];
		num[2] = num[4];
		num[4] = num[3];
		num[3] = temp;
	}
}