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 in = new BufferedReader(new InputStreamReader(System.in));

		Dice dice1 = new Dice();
		Dice dice2 = new Dice();

		dice1.createDice(in.readLine().split(" "));
		dice2.createDice(in.readLine().split(" "));

		dice1.check(dice2);
	}
}

class Dice {
	public int on, tw, th, fo, fi, si;

	public Dice() {

	}

	public Dice(int on, int tw, int th, int fo, int fi, int si) {
		this.on = on;
		this.tw = tw;
		this.th = th;
		this.fo = fo;
		this.fi = fi;
		this.si = si;
	}

	void createDice(String[] data) {
		int[] diceNums = new int[6];
		for (int i = 0; i < data.length; i++) {
			diceNums[i] = Integer.parseInt(data[i]);
		}
		on = diceNums[0];
		tw = diceNums[1];
		th = diceNums[2];
		fo = diceNums[3];
		fi = diceNums[4];
		si = diceNums[5];
	}

	void check(Dice otherDice) {
		boolean result = false;
		int checkTimes = 0;
		while (checkTimes <= 29) {
			while (checkTimes <= 5) {
				result = this.match(otherDice);
				if (result)
					break;
				checkTimes++;
				if (checkTimes == 5) {
					otherDice.north();
				} else {
					otherDice.rightSpin();
				}
			}

			while (checkTimes <= 10) {
				result = this.match(otherDice);
				if (result)
					break;
				checkTimes++;
				if (checkTimes == 10) {
					otherDice.west();
				} else {
					otherDice.rightSpin();
				}
			}

			while (checkTimes <= 15) {
				result = this.match(otherDice);
				if (result)
					break;
				checkTimes++;
				if (checkTimes == 15) {
					otherDice.north();
				} else {
					otherDice.rightSpin();
				}
			}

			while (checkTimes <= 20) {
				result = this.match(otherDice);
				if (result)
					break;
				checkTimes++;
				if (checkTimes == 20) {
					otherDice.west();
				} else {
					otherDice.rightSpin();
				}
			}

			while (checkTimes <= 25) {
				result = this.match(otherDice);
				if (result)
					break;
				checkTimes++;
				if (checkTimes == 25) {
					otherDice.north();
				} else {
					otherDice.rightSpin();
				}
			}

			while (checkTimes <= 29) {
				result = this.match(otherDice);
				if (result)
					break;
				checkTimes++;
				otherDice.rightSpin();
			}
			if (result)
				break;
		}

		if (result) {
			System.out.println("Yes"); // ?????´??????
		} else {
			System.out.println("No"); // ?????´?????????
		}
	}

	boolean match(Dice otherDice) {
		if (this.on == otherDice.on && this.tw == otherDice.tw
				&& this.th == otherDice.th && this.fo == otherDice.fo
				&& this.fi == otherDice.fi && this.si == otherDice.si) {
			return true;
		}
		return false;
	}

	void rightSpin() {
		int temp = tw;
		tw = fo;
		fo = fi;
		fi = th;
		th = temp;
	}

	public void north() {
		int temp = on;
		on = tw;
		tw = si;
		si = fi;
		fi = temp;
	}

	public void east() {
		int temp = on;
		on = fo;
		fo = si;
		si = th;
		th = temp;
	}

	public void west() {
		int temp = on;
		on = th;
		th = si;
		si = fo;
		fo = temp;
	}

	public void south() {
		int temp = on;
		on = fi;
		fi = si;
		si = tw;
		tw = temp;
	}
}