import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static class Dice {
		private int[] label;
		
		public static int ABOVE_INDEX = 0;
		public static int FRONT_INDEX = 1;
		public static int RIGHT_INDEX = 2;
		public static int LEFT_INDEX = 3;
		public static int BACK_INDEX = 4;
		public static int BELOW_INDEX = 5;
		
		public Dice(int[] num) {
			label = num;
		}
		
		public void roll(char op) {
			int tmp;
			
			switch (op) {
				case 'E':
					tmp = label[0];
					label[0] = label[3];
					label[3] = label[5];
					label[5] = label[2];
					label[2] = tmp;
					break;
				case 'N':
					tmp = label[0];
					label[0] = label[1];
					label[1] = label[5];
					label[5] = label[4];
					label[4] = tmp;
					break;
				case 'S':
					tmp = label[0];
					label[0] = label[4];
					label[4] = label[5];
					label[5] = label[1];
					label[1] = tmp;
					break;
				case 'W':
					tmp = label[0];
					label[0] = label[2];
					label[2] = label[5];
					label[5] = label[3];
					label[3] = tmp;
					break;
			}
		}
		
		public void horizontalRotation() {
			int tmp = label[1];
			label[1] = label[3];
			label[3] = label[4];
			label[4] = label[2];
			label[2] = tmp;
		}

		public void putDown(int aboveNum, int frontNum) {
			int i;
			for (i = 0; i < 4; i++) {
				roll('N');
				if (getAboveNum() == aboveNum) {
					break;
				}
			}
			
			if (i == 4) {
				for (i = 0; i < 4; i++) {
					roll('E');
					if (getAboveNum() == aboveNum) {
						break;
					}
				}
			}
			
			for (i = 0; i < 4; i++) {
				horizontalRotation();
				if (getNum(FRONT_INDEX) == frontNum) {
					break;
				}
			}
		}
		
		public int getAboveNum() {
			return label[0];
		}

		public int getNum(int index) {
			if (index >= label.length) {
				throw new IllegalArgumentException();
			}
			
			return label[index];
		}
		
		@Override
		public boolean equals(Object obj) {
			Dice arg = (Dice) obj; 
			for (int i = 0; i < label.length; i++) {
				boolean isExist = false;
				for (int j = 0; j < arg.label.length; j++) {
					if (label[i] == arg.label[j]) {
						isExist = true;
						break;
					}
				}
				if (!isExist) {
					return false;
				}
			}
			
			for (int i = 0; i < 4; i++) {
				arg.roll('N');

				for (int j = 0; j < 4; j++) {
					arg.horizontalRotation();
					boolean isSame = true;
					
					for (int k = 0; k < label.length; k++) {
						if (label[k] != arg.label[k]) {
							isSame = false;
							break;
						}
					}
					if (isSame) {
						return true;
					}
				}
			}
			
			arg.roll('E');

			for (int j = 0; j < 4; j++) {
				arg.horizontalRotation();
				boolean isSame = true;
				
				for (int k = 0; k < label.length; k++) {
					if (label[k] != arg.label[k]) {
						isSame = false;
						break;
					}
				}
				if (isSame) {
					return true;
				}
			}

			arg.roll('E');
			arg.roll('E');

			for (int j = 0; j < 4; j++) {
				arg.horizontalRotation();
				boolean isSame = true;
				
				for (int k = 0; k < label.length; k++) {
					if (label[k] != arg.label[k]) {
						isSame = false;
						break;
					}
				}
				if (isSame) {
					return true;
				}
			}
			
			return false;
		}
	}
	
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int[] nums1 = new int[6];
		
		for (int i = 0; i < nums1.length; i++) {
			nums1[i] = scan.nextInt();
		}

		Dice d1 = new Dice(nums1);

		int[] nums2 = new int[6];

		for (int i = 0; i < nums2.length; i++) {
			nums2[i] = scan.nextInt();
		}
		
		Dice d2 = new Dice(nums2);

		if (d1.equals(d2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		scan.close();
	}

}

Measured memory_bytes: 17376