//============================================================================
// Name        : ITP_1_11_A.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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


// [0]が上面にある時のサイコロの状態を作成。
// 反時計回り。
int DICE_NUMS[6][4] =
{
		{2,3,5,4},
		{6,3,1,4},
		{6,5,1,2},
		{6,2,1,5},
		{6,4,1,3},
		{5,3,2,4}
};

class Dice
{
public:
	int faces[6];
	int joumen_num;
	int shoumen_num;
	int shoumen_index;

public:
	Dice();

	void Roll(char cmd);
	void Rotate(char cmd);
	int GetShoumenIndex(int jou, int shou);
	int GetSideNum(char LR);
	bool CheckSame(Dice d);
	bool CheckProc(Dice d);
	//void Show();
};

Dice::Dice()
{
	// サイコロの初期状態
	joumen_num = 1;
	shoumen_num = 2;
	shoumen_index = GetShoumenIndex(joumen_num, shoumen_num);
}

void Dice::Roll(char cmd)
{
	int tmp_joumen = 0;
	int tmp_shoumen = 0;

	if(cmd == 'N'){
		tmp_shoumen = 7 - joumen_num;
		tmp_joumen = shoumen_num;
	}
	else if(cmd == 'E'){
		tmp_shoumen = shoumen_num;
		tmp_joumen = GetSideNum('L');
	}
	else if(cmd == 'S'){
		tmp_shoumen = joumen_num;
		tmp_joumen = 7 - shoumen_num;
	}
	else if(cmd == 'W'){
		tmp_shoumen = shoumen_num;
		tmp_joumen = GetSideNum('R');
	}
	joumen_num = tmp_joumen;
	shoumen_num = tmp_shoumen;
	shoumen_index = GetShoumenIndex(joumen_num, shoumen_num);
}
void Dice::Rotate(char cmd)
{
	if(cmd == 'L'){ //左が正面にくる
		shoumen_num = GetSideNum('L');
	}
	if(cmd == 'R'){ //右が正面にくる
		shoumen_num = GetSideNum('R');
	}
	if(cmd == 'O'){ //奥が正面にくる
		shoumen_num = GetSideNum('O');
	}
	shoumen_index = GetShoumenIndex(joumen_num, shoumen_num);
}

int Dice::GetSideNum(char LR)
{
	int res = 0;
	if(LR == 'L') res = DICE_NUMS[joumen_num-1][(shoumen_index + 3) % 4];
	if(LR == 'R') res = DICE_NUMS[joumen_num-1][(shoumen_index + 1) % 4];
	if(LR == 'O') res = DICE_NUMS[joumen_num-1][(shoumen_index + 2) % 4];
	return res;
}

int Dice::GetShoumenIndex(int jou, int shou){
	int res = 0;
	for(int i=0;i<4;i++){
		if(DICE_NUMS[joumen_num-1][i] == shou) res = i;
	}
	return res;
}

/*
void Dice::Show(){
	printf("%d ", faces[joumen_num-1]);
	printf("%d ", faces[shoumen_num-1]);
	printf("%d ", faces[GetSideNum('R')-1]);
	printf("%d ", faces[GetSideNum('L')-1]);
	printf("%d ", faces[GetSideNum('O')-1]);
	printf("%d ", faces[(7-joumen_num)-1]);
	printf("\n");

}
*/

bool Dice::CheckSame(Dice d)
{
	if(faces[joumen_num-1] != d.faces[d.joumen_num-1]) return false;
	if(faces[(7-joumen_num)-1] != d.faces[(7-d.joumen_num)-1]) return false;
	if(faces[shoumen_num-1] != d.faces[d.shoumen_num-1]) return false;
	if(faces[GetSideNum('R')-1] != d.faces[d.GetSideNum('R')-1]) return false;
	if(faces[GetSideNum('O')-1] != d.faces[d.GetSideNum('O')-1]) return false;
	if(faces[GetSideNum('L')-1] != d.faces[d.GetSideNum('L')-1]) return false;
	return true;
}

bool Dice::CheckProc(Dice d)
{
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(CheckSame(d)){
				return true;
			}
			d.Rotate('L');
		}
		d.Roll('N');
	}

	d.Roll('E');
	for(int j=0;j<4;j++){
		if(CheckSame(d)){
			return true;
		}
		d.Rotate('L');
	}

	d.Roll('W');
	d.Roll('W');
	for(int j=0;j<4;j++){
		if(CheckSame(d)){
			return true;
		}
		d.Rotate('L');
	}

	return false;
}

int main()
{
	Dice d1;
	Dice d2;

	for(int q=0;q<6;q++){
		cin >> d1.faces[q];
	}
	for(int q=0;q<6;q++){
		cin >> d2.faces[q];
	}

	if(!d1.CheckProc(d2)){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
	}

	return 0;
}



Measured memory_bytes: 3120