#include<iostream>
#include<cmath>

using namespace std;
class Dice{
public:
    int face[7],n;
    Dice(){}
    void role_E(){
        role(1,3,6,4);
    };
    void role_N(){
        role(1,5,6,2);
    };
    void role_S(){
        role(1,2,6,5);
    };
    void role_W(){
        role(1,4,6,3);
    };
    void role_z(){
        role(2,3,5,4);
    }
    
    void role(int i, int j, int k, int l){
        n = face[l],face[l] = face[k], face[k] = face[j], face[j] = face[i], face[i] = n;
        
    }

};
bool sam(Dice C1, Dice C2){
    for (int i = 1; i < 7; i++){
        if (C1.face[i] != C2.face[i]) return false;
        
    }return true;
}
bool same(Dice C1, Dice C2){
    for (int i = 0; i < 6; i++){
        for(int j = 0; j < 4; j++){
            if(sam(C1,C2)) return true;
            C1.role_z();
        }
        if(i % 2 == 0) C1.role_W();
        else C1.role_N();
    }return false;
}


int main(){
    Dice dice1,dice2;
    
    for (int i = 1; i<7; i++) cin >> dice1.face[i];
    for (int i = 1; i<7; i++) cin >> dice2.face[i];
    
    if(same(dice1, dice2)) cout<<"Yes" <<endl;
    else cout<<"No"<<endl;
 return 0;
}
