#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

class dice{
public:
	int d[6];
	void set(int n, int x){
		d[n] = x;
	}
	int get(int n){
		return d[n];
	}
	void rotate(char c){
		int tmp;
		switch (c){
		case 'W':
			tmp = d[3];
			d[3] = d[0];
			d[0] = d[2];
			d[2] = d[5];
			d[5] = tmp;
			break;
		case 'E':
			tmp = d[5];
			d[5] = d[2];
			d[2] = d[0];
			d[0] = d[3];
			d[3] = tmp;
			break;
		case 'N':
			tmp = d[0];
			d[0] = d[1];
			d[1] = d[5];
			d[5] = d[4];
			d[4] = tmp;
			break;
		case 'S':
			tmp = d[4];
			d[4] = d[5];
			d[5] = d[1];
			d[1] = d[0];
			d[0] = tmp;
			break;
		}
	}
	void espin(){
		rotate('S');
		rotate('E');
		rotate('N');
	}
	bool operator ==(dice e){
		bool flag;
		string s = "SESESE";
		for (int i = 0; i < 6; i++){
			e.rotate(s[i]);
			if (d[0] == e.get(0)){
				for (int j = 0; j < 4; j++){
					flag = true;
					for (int k = 1; k < 6; k++){
						if (d[k] != e.get(k)) flag = false;
					}
					if (flag) return true;
					e.espin();
				}
			}
			if (i == 5) return false;
		}
	}
};

int main(){
	int tmp;
	dice d, c, e;
	for (int i = 0; i < 6; i++){
		cin >> tmp;
		d.set(i, tmp);
	}
	for (int i = 0; i < 6; i++){
		cin >> tmp;
		c.set(i, tmp);
	}
	if (d == c) cout << "Yes" << endl;
	else cout << "No" << endl;

}