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

		Dice d = new Dice(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
		Dice d2 = new Dice(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());

		char[] cmd = "EEEENEEEENEEEENEEEENWNEEEENNEEEE".toCharArray();
		boolean flag = false;
		out:
		for (int i = 0; i < cmd.length; i++) {
			if (cmd[i] == 'N') {
				d.N();
			} else if (cmd[i] == 'S') {
				d.S();
			} else if (cmd[i] == 'E') {
				d.E();
			} else if (cmd[i] == 'W') {
				d.W();
			}
			for (int j = 0; j < cmd.length; j++) {
				if (cmd[j] == 'N') {
					d2.N();
				} else if (cmd[j] == 'S') {
					d2.S();
				} else if (cmd[j] == 'E') {
					d2.E();
				} else if (cmd[j] == 'W') {
					d2.W();
				}
				if (d.isSame(d2)) {
					flag = true;
					break out;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
	
	private static class Dice {
		int[] s;
		int up;
		int north;
		int east;

		Dice(int s1, int s2, int s3, int s4, int s5, int s6) {
			s = new int[6];
			s[0] = s1;
			s[1] = s2;
			s[2] = s3;
			s[3] = s4;
			s[4] = s5;
			s[5] = s6;
			up = 1;
			north = 5;
			east = 3;
		}
		
		public boolean isSame(Dice d2) {
			boolean flag = true;
			for (int i = 0; i < 6; i++) {
				if (s[up - 1] != d2.s[d2.up - 1]
					|| s[7 - up - 1] != d2.s[7 - d2.up - 1]
					|| s[north - 1] != d2.s[d2.north - 1]
					|| s[7 - north - 1] != d2.s[7 - d2.north - 1]
					|| s[east - 1] != d2.s[d2.east - 1]
					|| s[7 - east - 1] != d2.s[7 - d2.east - 1]) {
					flag =false;
				}
			}
			
			return flag;
		}

		void N() {
			int temp = 7 - north;
			north = up;
			up = temp;
		}
		
		void S() {
			int temp = 7 - up;
			up = north;
			north = temp;
		}
		
		void E() {
			int temp = 7 - east;
			east = up;
			up = temp;
		}

		void W() {
			int temp = 7 - up;
			up = east;
			east = temp;
		}
		
//		int now() {
//			return s[up - 1];
//		}

		public int getEast(int upValue, int southValue) {
			int upNow;
			for (upNow = 1; upNow <= 6; upNow++) {
				if (s[upNow - 1] == upValue) {
					break;
				}
			}
			int northNow;
			for (northNow = 1; northNow <= 6; northNow++) {
				if (s[northNow - 1] == southValue) {
					northNow = 7 - northNow;
					break;
				}
			}
			
			char[] cmd = "EEEENEEEENEEEENEEEENWNEEEENNEEEE".toCharArray();
			for (int i = 0; i < cmd.length; i++) {
				if (cmd[i] == 'N') {
					N();
				} else if (cmd[i] == 'S') {
					S();
				} else if (cmd[i] == 'E') {
					E();
				} else if (cmd[i] == 'W') {
					W();
				}
				if (northNow == this.north && upNow == this.up) {
					return s[east - 1];
				} else if (northNow == 7 - this.north && upNow == this.up) {
					return s[7 - east - 1];
				} else if (northNow == this.north && upNow == 7 - this.up) {
					return s[7 - east - 1];
				}
			}
			
			return -1;
		}
	}
}