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.*;
import java.util.stream.IntStream;

class Dice {
	int[] surfaces = new int[6];

	Dice(int[] diceNumArr) {surfaces = diceNumArr;}

	public int getTopNumber() {return surfaces[0];}

	public void move(String str) {
		for (char d : str.toCharArray()) {
			if (d == 'E') {roll(true, false, false);}
			else if (d == 'W') {IntStream.range(0, 3).forEach(e -> roll(true, false, false));}
			else if (d == 'S') {IntStream.range(0, 3).forEach(e -> roll(false, true, false));}
			else if (d == 'N') {roll(false, true, false);}
		}
	}

	private void roll(boolean x, boolean y, boolean z) {
		if (x && !y && !z) {roll(0, 3, 5, 2);}
		else if (!x && y && !z) {roll(0, 1, 5, 4);}
		else if (!x && !y && z) {roll(1, 2, 4, 3);}
	}

	private void roll(int w, int x, int y, int z) {
			int tmp = surfaces[w];
			surfaces[w] = surfaces[x];
			surfaces[x] = surfaces[y];
			surfaces[y] = surfaces[z];
			surfaces[z] = tmp;
	}

	public void setTopAndFront(int top, int front) {
		isSame(top, front, -1);
	}

	private boolean isSame(int... srf) {
		for (int xy = 0; xy < 6; xy++) {
			for (int z = 0; z < 4; z++) {
				if (surfaces[0] == srf[0] && surfaces[1] == srf[1] && srf[2] < 0) return false;
				int[] a = Arrays.copyOfRange(surfaces, 2, surfaces.length);
				int[] b = Arrays.copyOfRange(srf, 2, srf.length);
				if (Arrays.equals(a, b)) return true;
				roll(false, false, true);
			}
			if (xy % 2 == 0) {roll(true, false, false);}
			else {roll(false, true, false);}
		}
		return false;
	}

	@Override
	public boolean equals(Object obj) {
		Dice other = (Dice) obj;
		return isSame(other.surfaces);
	}
}
public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			int[] numArr = {sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()};
			int[] numArr2 = {sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()};
			Dice dice = new Dice(numArr);
			Dice dice2 = new Dice(numArr2);

			System.out.println(dice.equals(dice2) ? "Yes" : "No");
		}
	}
}
