#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

struct Cube
{
	int f[6];
	Cube(){}

	void roll(int i,int j,int k,int l)
	{
		int t = f[i];
		f[i] = f[j];
		f[j] = f[k];
		f[k] = f[l];
		f[l] = t;
	}

	void roll_z() { roll(1,2,4,3); }
	void roll_y() { roll(0,2,5,3); }
	void roll_x() { roll(0,1,5,4); }

	void move(char c)
	{
		if(c == 'E') rep(i,3) roll_y();
		else if(c == 'W') roll_y();
		else if(c == 'N') roll_x();
		else if(c == 'S') rep(i,3) roll_x();
	}
};

bool equal_1(Cube c1,Cube c2)
{
	rep(i,6)
	{
		if(c1.f[i] != c2.f[i]) return false;
	}
	return true;
}

bool equal_2(Cube c1,Cube c2)
{
	rep(i,6)
	{
		rep(j,4)
		{
			if(equal_1(c1,c2)) return true;
			c1.roll_z();
		}
		if(i%2 == 0)
		{
			c1.roll_y();
		}
		else
		{
			c1.roll_x();
		}
	}
	return false;
}

int main()
{
	Cube c1,c2;

	rep(i,6) cin >> c1.f[i];
	rep(i,6) cin >> c2.f[i];

	if(equal_2(c1,c2))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}