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.HashSet;
import java.util.Scanner;
import java.util.Set;

class MathUtil {
	public static void swap(int[] obj, int a, int b) {
		int tmp = obj[a];
		obj[a] = obj[b];
		obj[b] = tmp;
	}
}

class Dice {
	int N=6;
	int ten[] = new int[N+1];

	public Dice(int[] tenkaizu) {
		for(int i=1;i<=N;i++) {
			this.ten[i] = tenkaizu[i-1];
		}
	}

	@Override
	public boolean equals(Object obj) {
		return this.toNumberStr().equals(((Dice)obj).toNumberStr());
	}

	@Override
	public int hashCode() {
		return (int)Long.parseLong(toNumberStr());
	}

	public int showDice(int number) {
		return ten[number];
	}

	public void printDice() {
	    for(int i=1;i<=N;i++) {
            System.out.print(ten[i] + "\t");
        }
        System.out.println("");
    }

	public void rotate(String meirei) {
		switch (meirei) {
			case "N":
				rotate(1, 2, 6, 5);
				break;
			case "S":
				rotate(5,6, 2, 1);
				break;
			case "E":
				rotate(4, 6, 3, 1);
				break;
			case "W":
				rotate(1, 3, 6, 4);
				break;
		}
	}

	public void rotate(int a, int b, int c, int d) {
		MathUtil.swap(ten, a, b);
		MathUtil.swap(ten, b, c);
		MathUtil.swap(ten, c, d);
	}

	public void rotate(int a, int b, int c) {
		MathUtil.swap(ten, a, b);
		MathUtil.swap(ten, b, c);
	}

	/**
	 * ????????????????????¢??????d?????????
	 * @param d
	 */
	public void topTo(int d) {
		for(int i=0;i<4;i++) {
			rotate("W");
			if(showDice(1) == d) break;
		}
		for(int i=0;i<4;i++) {
			rotate("N");
			if(showDice(1) == d) break;
		}
	}

	public int findRight(int frontD) {
		int[] pos = {4,2,3,5};
		for(int i=0;i<4;i++) {
			if(ten[pos[i]] == frontD) {
				return ten[pos[(i+1)%4]];
			}
		}
		return -1;
	}

	public String toNumberStr() {
		String str = "";
		for(int i=1;i<=N;i++) {
			str += ""+ten[i];
		}
		return str;
	}
}

class DiceUtil {
	static Set<String> diceSet;
	public static boolean isSame(Dice d1, Dice d2) {
		diceSet = new HashSet<>();
		return dfs(d1, d2);
	}

	public static boolean dfs(Dice d1, Dice d2) {
		int n = diceSet.size();
		if(diceSet.contains(d1)) return false;
		if(d1.equals(d2)) return true;
		diceSet.add(d1.toNumberStr());
		if(n == diceSet.size()) return false;
		for(int i=0;i<4;i++) {
			d1.rotate("N");
			if(dfs(d1, d2)) return true;
		}
		for(int i=0;i<4;i++) {
			d1.rotate("E");
			if(dfs(d1, d2)) return true;
		}
		return false;
	}
}

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] men_str = in.nextLine().split(" ");
		int[] men_int = new int[6];
		for (int i = 0; i < 6; i++) {
			men_int[i] = Integer.parseInt(men_str[i]);
		}
		Dice dice = new Dice(men_int);
		men_str = in.nextLine().split(" ");
        for (int i = 0; i < 6; i++) {
			men_int[i] = Integer.parseInt(men_str[i]);
		}
		Dice dice2 = new Dice(men_int);

        if(DiceUtil.isSame(dice, dice2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}