#include <iostream>
#include <string>
#include <vector>
using namespace std;

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

long long read(void) {
	long long d;
	cin >> d;
	return d;
}
void println(void) {
	cout << endl;
}
template <typename T>void print(T t) {
	cout << t;
}
template <typename T>void println(T t) {
	print(t);
	println();
}

class Dice{
public:
	explicit Dice(std::vector<int> dice): Points_(dice) {
	}
	~Dice() {}
	int Top(void) const { return Points_[0]; }
	int South(void) const { return Points_[1]; }
	int East(void) const { return Points_[2]; }
	int At(int i) const {
		if (i >= 0 && i < Points_.size()) return Points_[i];
		return -1;
	}
	std::vector<int> All(void) const { return Points_; }
	void Println(void) const {
		std::cout << Points_[0];
		for (int i = 1; i < Points_.size(); ++i) {
			std::cout << " " << Points_[i];
		}
		std::cout << std::endl;
	}
	Dice& Roll(char c){
		switch (c)
		{
		case 'N': RollN(); break;
		case 'E': RollE(); break;
		case 'S': RollS(); break;
		case 'W': RollW(); break;
		case 'R': RollR(); break;
		case 'L': RollL(); break;
		default:
			break;
		}
		return *this;
	}
	Dice& Rolls(const string& rolls) {
		for(int i = 0; i < rolls.size(); ++i) {
			Roll(rolls[i]);
		}
		return *this;
	}
	int Search(int target) const {
		for (int i = 0; i < Points_.size(); ++i) {
			if (Points_[i] == target) {
				return i;
			}
		}
		return -1;
	}
	int SearchAndRoll(int target, std::vector<std::string> rolls) {
		int pos = Search(target);
		if (pos >= 0) {
			Rolls(rolls[pos]);
		}
		return pos;
	}
	int SearchAndRollTop(int target) {
		std::vector<std::string> rolls = {"", "N", "W", "E", "S", "NN"};
		return SearchAndRoll(target, rolls);
	}
	int SearchAndRollSouth(int target) {
		std::vector<std::string> rolls = {"", "", "R", "L", "RR", ""};
		return SearchAndRoll(target, rolls);
	}
	bool IsEqual(const Dice& target) const {
		for (int i = 0; i < Points_.size(); ++i) {
			if (Points_[i] !=  target.At(i)) {
				return false;
			}
		}
		return true;
	}
	bool IsSame(const Dice& target) {
		if (IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		RollR();

		if (RollN().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		RollR();

		if (RollN().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		RollR();

		if (RollN().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		RollR();
		RollN();

		if (RollW().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		RollR();
		RollE();

		if (RollE().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;
		if (RollR().IsEqual(target)) return true;

		return false;
	}

private:
	std::vector<int> Points_;
	Dice& RollN(void) {
		int temp = Points_[0];
		Points_[0] = Points_[1];
		Points_[1] = Points_[5];
		Points_[5] = Points_[4];
		Points_[4] = temp;
		return *this;
	}
	Dice& RollE(void) {
		int temp = Points_[0];
		Points_[0] = Points_[3];
		Points_[3] = Points_[5];
		Points_[5] = Points_[2];
		Points_[2] = temp;
		return *this;
	}
	Dice& RollS(void) {
		int temp = Points_[0];
		Points_[0] = Points_[4];
		Points_[4] = Points_[5];
		Points_[5] = Points_[1];
		Points_[1] = temp;
		return *this;
	}
	Dice& RollW(void) {
		int temp = Points_[0];
		Points_[0] = Points_[2];
		Points_[2] = Points_[5];
		Points_[5] = Points_[3];
		Points_[3] = temp;
		return *this;
	}
	Dice& RollR(void) {
		int temp = Points_[1];
		Points_[1] = Points_[2];
		Points_[2] = Points_[4];
		Points_[4] = Points_[3];
		Points_[3] = temp;
		return *this;
	}
	Dice& RollL(void) {
		int temp = Points_[1];
		Points_[1] = Points_[3];
		Points_[3] = Points_[4];
		Points_[4] = Points_[2];
		Points_[2] = temp;
		return *this;
	}
};

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);

	vector<int> points(6);
	REP(i, points.size()) {
		points[i] = read();
	}
	Dice dice1(points);
	REP(i, points.size()) {
		points[i] = read();
	}
	Dice dice2(points);

	println(dice1.IsSame(dice2) ? "Yes" : "No");

	return 0;
}



Measured memory_bytes: 3216