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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		// ????????????????????\???
		String first_lines = input.readLine();

		// ??\??????????????°??????1??¢??????6??¢?????§??????????????????????????§?????????????????????
		Dice_third insdice = new Dice_third(first_lines.split(" "));

		// 2???????????????????????\???
		String second_lines = input.readLine();

		String[] another_dice_array = second_lines.split(" ");

		int[] another_dice_num = new int[6];

		for (int array_spot = 0; array_spot < another_dice_array.length; array_spot++) {

			another_dice_num[array_spot] = Integer.parseInt(another_dice_array[array_spot]);

		}

		// ??\????????????????????????????????¢????????¢??????????????¢????????????????????????????????????dice_roll??????????????????
		insdice.dice_roll(another_dice_num[0], another_dice_num[1], another_dice_num[2], another_dice_num[3],

				another_dice_num[4], another_dice_num[5]);

		System.out.println(insdice.get_answer());

	}

}

class Dice_third {

	int[] array_dice = new int[6];

	int top = 0;

	int bottom = 0;

	int front = 0;

	int back = 0;

	int right = 0;

	int left = 0;

	String answer = "No";

	// top?????°????????\??????????????????????????°
	int num;

	// front?????°????????\??????????????????????????°
	int num_front;

	// ????????????????????????????????£????????????????????\????????????????????§???????????§?????????
	Dice_third(String[] strings) {

		this.top = Integer.parseInt(strings[0]);

		this.front = Integer.parseInt(strings[1]);

		this.right = Integer.parseInt(strings[2]);

		this.left = Integer.parseInt(strings[3]);

		this.back = Integer.parseInt(strings[4]);

		this.bottom = Integer.parseInt(strings[5]);

	}

	// 1?????????????????°??¨????????????????????????????????¶???????????????
	void dice_roll(int top_side, int front_side, int right_side, int left_side, int back_side, int bottom_side) {

		// ????????????????????£???????????¨???????????????????????????top,front?????\?????????????????°??¨?????´????????¨???????????¢??????????????????
		for (int East_roll = 0; East_roll < 2; East_roll++) {

			// ???????????????4???????????¢???????????¨??????1?????¢
			for (int South_roll = 0; South_roll < 4; South_roll++) {

				for (int horizontal_roll = 0; horizontal_roll < 4; horizontal_roll++) {

					num = front;

					front = right;

					right = back;

					back = left;

					left = num;

					// ??\????????????top??¨
					if (top == top_side && front == front_side && right == right_side && left == left_side

							&& back == back_side && bottom == bottom_side) {

						answer="Yes";

					}

				}

				num = top;

				top = back;

				back = bottom;

				bottom = front;

				front = num;
			}

			num = top;

			top = left;

			left = bottom;

			bottom = right;

			right = num;

		}
	}

	String get_answer() {

		return answer;

	}
}