#include<iostream>
//#include<cmath>
#include <string>
#include<vector>
#include <iomanip>
using namespace std;

class Dice{
private:
//  vector<vector<int>> nextsurface(6,vector<int>(4));
vector<int> surface;
public:
  Dice(vector<int> dice){
    surface=dice;
  }

  void roll_dice(char direction){
    if(direction=='N'){
      int temp=surface.at(0);
      surface.at(0)=surface.at(1);
      surface.at(1)=surface.at(5);
      surface.at(5)=surface.at(4);
      surface.at(4)=temp;
    }
    else if(direction=='E'){
      int temp=surface.at(0);
      surface.at(0)=surface.at(3);
      surface.at(3)=surface.at(5);
      surface.at(5)=surface.at(2);
      surface.at(2)=temp;
    }
    else if(direction=='S'){
      int temp=surface.at(0);
      surface.at(0)=surface.at(4);
      surface.at(4)=surface.at(5);
      surface.at(5)=surface.at(1);
      surface.at(1)=temp;
    }
    else{
      int temp=surface.at(0);
      surface.at(0)=surface.at(2);
      surface.at(2)=surface.at(5);
      surface.at(5)=surface.at(3);
      surface.at(3)=temp;
    }
  }

  void disp_topdice(){
    cout<<surface.at(0)<<endl;
  }

  int get_surfacenum(int snum){
    return surface.at(snum-1);
  }
  int get_insurfacenum(int snum){
    return surface.at(snum);
  }

  int right_side(int upper,int front){
    int upperface,frontface;
    for(int i=0;i<6;i++){
      if(upper==surface.at(i)) upperface=i;
      if(front==surface.at(i)) frontface=i;
    }
    switch(upperface){
      //return は内部のindex+1
      case 0:
      if(frontface==1) return 2+1;
      else if(frontface==2) return 4+1;
      else if(frontface==4) return 3+1;
      else if(frontface==3) return 1+1;
      break;
      case 1:
      if(frontface==5) return 2+1;
      else if(frontface==2) return 1;
      else if(frontface==0) return 3+1;
      else if(frontface==3) return 5+1;
      break;
      case 2:
      if(frontface==5) return 4+1;
      else if(frontface==4) return 1;
      else if(frontface==0) return 1+1;
      else if(frontface==1) return 5+1;
      break;
      case 3:
      if(frontface==5) return 1+1;
      else if(frontface==1) return 1;
      else if(frontface==0) return 4+1;
      else if(frontface==4) return 5+1;
      break;
      case 4:
      if(frontface==5) return 3+1;
      else if(frontface==3) return 1;
      else if(frontface==0) return 2+1;
      else if(frontface==2) return 5+1;
      break;
      case 5:
      if(frontface==1) return 3+1;
      else if(frontface==3) return 4+1;
      else if(frontface==4) return 2+1;
      else if(frontface==2) return 1+1;
      break;
    }
  }
  void cicle_dice(string roll){
    if(roll=="CCW"){
      int temp=surface.at(1);
      surface.at(1)=surface.at(3);
      surface.at(3)=surface.at(4);
      surface.at(4)=surface.at(2);
      surface.at(2)=temp;
    }
    if(roll=="CW"){
      int temp=surface.at(1);
      surface.at(1)=surface.at(2);
      surface.at(2)=surface.at(4);
      surface.at(4)=surface.at(3);
      surface.at(3)=temp;
    }
  }

};
bool correct_rolling(Dice dice1,Dice dice2){//at(0)はもう一個の0番目の面
  for(int i=0;i<6;i++){
    if(dice1.get_insurfacenum(0)==dice2.get_insurfacenum(i)){
      switch(i){
        case 0: break;
        case 1:
        dice2.roll_dice('N'); break;
        case 2:
        dice2.roll_dice('W'); break;
        case 3:
        dice2.roll_dice('E'); break;
        case 4:
        dice2.roll_dice('S'); break;
        case 5:
        dice2.roll_dice('N');dice2.roll_dice('N');
        break;
      }
      if(dice1.get_insurfacenum(5)==dice2.get_insurfacenum(5)){
        for(int n=0;n<4;n++){
          for(int j=1;j<5;j++){
            if(dice1.get_insurfacenum(j)!=dice2.get_insurfacenum(j)) break;
            if(j==4&&(dice1.get_insurfacenum(j)==dice2.get_insurfacenum(j))){
              cout<<"Yes"<<endl;
              return true;
            }
          }
          dice2.cicle_dice("CW");
        }
      }
    }
  }
  cout<<"No"<<endl;
  return false;
}


int main(void){
  vector<int> dice(6);
//  string str;
  int loop,up,frnt,snum;

  for(int i=0;i<6;i++)cin>>dice.at(i);
  Dice dice1(dice);
  for(int i=0;i<6;i++)cin>>dice.at(i);
  Dice dice2(dice);
  correct_rolling(dice1,dice2);

//  cin>>str;
  //for(int i=0;i<str.size();i++) dice1.roll_dice(str[i]);
//  dice1.disp_topdice();
//cin>>loop;
//for(int i=0;i<loop;i++){
//  cin>>up>>frnt;
//  snum=dice1.get_surfacenum(dice1.right_side(up,frnt));
//  cout<<snum<<endl;
//}

  return 0;


}



Measured memory_bytes: 3184