//???????????£?¨?
class Dice{
	
public:
	Dice(int top, int front, int right,
		 int left, int back, int bottom);  //?????????????????????(?????°??????)
	int get_top();
	int get_front();
	int get_right();
	int get_left();
	int get_back();
	int get_bottom();
	bool roll_topfront(int top, int front);
	void roll(char r);
	bool equals(Dice &b);
	
private:
	
	bool roll_top(int top);
	bool roll_front(int front);
	bool kakunin4(int right, int left, int back, int bottom);
	void roll_n();
	void roll_e();
	void roll_s();
	void roll_w();
	int m_top;
	int m_front;
	int m_right;
	int m_left;
	int m_back;
	int m_bottom;
	void show_all();
};

#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> Dice_bec;

int main(void)
{
	Dice_bec dice_bec1, dice_bec2;
	int num;
	
	for(int i = 0; i < 6; i++){
		cin >> num;
		dice_bec1.push_back(num);
	}
	
	for(int i = 0; i < 6; i++){
		cin >> num;
		dice_bec2.push_back(num);
	}
	
	
	Dice dice1(dice_bec1[0], dice_bec1[1], dice_bec1[2],
			   dice_bec1[3], dice_bec1[4], dice_bec1[5]);  //?????????????????????1
			  
	Dice dice2(dice_bec2[0], dice_bec2[1], dice_bec2[2],
			   dice_bec2[3], dice_bec2[4], dice_bec2[5]); //?????????????????????2
	
	if(dice1.equals(dice2) == true){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	
	return 0;
	
}

Dice::Dice(int top, int front, int right,      //?????????????????????
		   int left, int back, int bottom) :
		   m_top(top), m_front(front), m_right(right),
		   m_left(left), m_back(back), m_bottom(bottom)
{
	//	????????????
}

bool Dice::equals(Dice &b)
{
	 if(roll_topfront(b.get_top(), b.get_front()) == false){
	 	//cout << __func__ << ":" << __LINE__ <<endl;
	 	return false;
	 }
	 else if(kakunin4(b.get_right(), b.get_left(),
	 				  b.get_back(), b.get_bottom()) == false){
	 	//cout << __func__ << ":" << __LINE__ <<endl;
	 	return false;
	 }
	 else{
	 	return true;
	 }
	 ;
}

bool Dice::roll_topfront(int top, int front)
{
	if(roll_front(front) == true){
		if(roll_top(top) == true){		
			return true;
		}
	}
	//cout << __func__ << ":" << __LINE__ <<endl;
	return false;
	
	
}

bool Dice::roll_front(int front)
{
	if(front == m_front){
		return true;
	}
	//????????¢
	else if(front == m_top){
		roll_s();
		if(front == m_front){
			return true;
		}
	}
	else if(front == m_back){
		for(int i = 0; i < 2; i++){
			roll_s();
		}
		if(front == m_front){
			return true;
		}
	}
	else if(front == m_bottom){
		roll_n();
		if(front == m_front){
			return true;
		}
	}
	//?¨??????¢
	else if(front == m_right){
		roll_w();
		roll_s();
		if(front == m_front){
			return true;
		}
	}
	else if(front == m_left){
		roll_e();
		roll_s();
	}
	if(front == m_front){
		return true;
	}
	else{
		//cout << __func__ << ":" << __LINE__ <<endl;
		return false;
	}
}

bool Dice::roll_top(int top)
{
	for(int i = 0; i < 4; i++){
		
		roll_e();
		if(top == m_top){
			return true;
		}
	}
	//cout << __func__ << ":" << __LINE__ <<endl;
	return false;
	
}

bool Dice::kakunin4(int right, int left, int back, int bottom)
{
	return ((right == m_right) && (left == m_left) &&
			(back == m_back) && (bottom == m_bottom));
}
void Dice::roll_n()
{
	int temp = m_back;
	
	m_back   = m_top;
	m_top    = m_front;
	m_front  = m_bottom;
	m_bottom = temp;
	
}
void Dice::roll_e()
{
	int temp = m_top;
	
	m_top    = m_left;
	m_left   = m_bottom;
	m_bottom = m_right;
	m_right  = temp;
	
}

void Dice::roll_s()
{
	int temp = m_front;
	
	m_front  = m_top;
	m_top    = m_back;
	m_back   = m_bottom;
	m_bottom = temp;
}

void Dice::roll_w()
{
	int temp = m_left;
	
	m_left   = m_top;
	m_top    = m_right;
	m_right  = m_bottom;
	m_bottom = temp;
}
int Dice::get_top()
{
	return m_top;
}
int Dice::get_front()
{
	return m_front;
}
int Dice::get_right()
{
	return m_right;
}
int Dice::get_left()
{
	return m_left;
}
int Dice::get_back()
{
	return m_back;
}
int Dice::get_bottom()
{
	return m_bottom;
}

void Dice::show_all()
{
	cout << m_top << ' '
		 << m_front << ' '
		 << m_right<< ' '
		 << m_left << ' '
		 << m_back << ' '
		 << m_bottom << ' ' << endl;
}

void Dice::roll(char r)
{
	switch(r){
	case 'N' :
		 roll_n();
		 break;
	case 'E' :
		 roll_e();
		 break;
	case 'S' :
		 roll_s();
		 break;
	case 'W' :
		 roll_w();
		 break;
	}
}

Measured memory_bytes: 3152