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 scan = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		// ??????????????£??????????´?
		int num[] = { scan.nextInt(), scan.nextInt(), scan.nextInt(), scan.nextInt(), scan.nextInt(), scan.nextInt() };
		int num2[] = { scan.nextInt(), scan.nextInt(), scan.nextInt(), scan.nextInt(), scan.nextInt(), scan.nextInt() };
		int result = check(num, num2);

		if (result == 1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	// ?????????????????????????????¢??¨?????¢?????????????????????
	private static int check(int num[], int num2[]) {
		int top = num[0];
		int front = num[1];
		int left = num[2];
		int right = num[3];
		int back = num[4];
		int bot = num[5];

		// top????????´???????????´??????false
		boolean flg = false;
		// top?????????????¨????????????????????????¨????????????????????´???????????´??????false
		boolean flg2 = false;

		for (int count2 = 0; count2 < 2; count2++) {

			// ??????????????????????????????????????????
			for (int count = 0; count < 4; count++) {

				// num2[0](top)???????????????num[]???
				if (num2[0] == num[0]) {
					if (num2[5] == num[5]) {
						flg = true;
						break;
					}
				}

				// ?????????num1??????????¶???????????????£??????????????£??\????????¨?????´??°?????????????????????????????????????????????????????£?????????
				int x1 = num[1];
				num[1] = num[0];
				num[0] = num[4];
				num[4] = num[5];
				num[5] = x1;
			}
			// ???????¨??????¢?????????
			int x2 = num[1];
			num[1] = num[3];
			num[3] = num[4];
			num[4] = num[2];
			num[2] = x2;
		}

		// ?¨???????4????????¨????????´??????????¢??????????
		for (int count3 = 0; count3 < 4; count3++) {

			if (num2[1] == num[1]) {
				if (num2[2] == num[2]) {
					if (num2[3] == num[3]) {
						if (num2[4] == num[4]) {
							flg2 = true;
							break;
						}

					}
				}

			}

			// ???????¨??????¢?????????
			int x2 = num[1];
			num[1] = num[3];
			num[3] = num[4];
			num[4] = num[2];
			num[2] = x2;

		}
		
		

		int rs = 0;

		if (flg & flg2) {
			rs = 1;
		} else {
			rs = 0;
		}

		return rs;
	}
}