#include<stdio.h>
#include<string.h>

struct saikoro{

    int Size[6] = {0};
    int up, down;
    int south, east, west, north;
    int next_up, next_down, next_south, next_east, next_west, next_north;
public : 
    saikoro(){  //初期化
        up = Size[0];
        south = Size[1];
        east = Size[2];
        west = Size[3];
        north = Size[4];
        down = Size[5];

        next_up = 0;
        next_south = 0;
        next_north = 0;
        next_east = 0;
        next_west = 0;
        next_down = 0;
    }

    void init(){  //再初期化
        up = Size[0];
        south = Size[1];
        east = Size[2];
        west = Size[3];
        north = Size[4];
        down = Size[5];
    }
    int gettop(){ return up; }
    void change(char ch){
        if(ch == 'S'){
        next_up = north;
        next_south = up;
        next_north = down;
        next_down = south;

        up = next_up;
        south = next_south;
        north = next_north;
        down = next_down;
        } else if(ch == 'N'){
        next_up = south;
        next_south = down;
        next_north = up;
        next_down = north; 

        up = next_up;
        south = next_south;
        north = next_north;
        down = next_down;
        } else if(ch == 'E'){
        next_up = west;
        next_east = up;
        next_west = down;
        next_down = east; 

        up = next_up;
        east = next_east;
        west = next_west;
        down = next_down;
        } else if(ch == 'W'){       
        next_up = east;
        next_east = down;
        next_west = up;
        next_down = west; 

        up = next_up;
        east = next_east;
        west = next_west;
        down = next_down;
        }else if(ch == 'R'){
        next_south = west;
        next_east = south;
        next_west = north;
        next_north = east; 

        south = next_south;
        east = next_east;
        west = next_west;
        north = next_north;
        }
    }
};

int main(){

    saikoro S1, S2;
    for(int i=0; i<6; i++){
        scanf("%d", &S1.Size[i]);
    }
    for(int i=0; i<6; i++){
        scanf("%d", &S2.Size[i]);
    }
    S1.init();
    S2.init();

    bool flag = false;
    for(int i=0; i<6; i++){
        if(flag == true) break;
        if(S1.up == S2.Size[i]){
            if(S2.Size[i] == S2.north) S2.change('S');
            else if(S2.Size[i] == S2.south) S2.change('N');
            else if(S2.Size[i] == S2.west) S2.change('E');
            else if(S2.Size[i] == S2.east) S2.change('W');
            else if(S2.Size[i] == S2.down) {
                S2.change('N');
                S2.change('N');
            }
            flag = true;
        }
    }

    //最大三回転
    if(S1.south != S2.south) S2.change('R');
    //printf("%d %d %d %d %d %d\n", S2.up, S2.south, S2.west, S2.east, S2.north, S2.down);
    if(S1.south != S2.south) S2.change('R');
    //printf("%d %d %d %d %d %d\n", S2.up, S2.south, S2.west, S2.east, S2.north, S2.down);
    if(S1.south != S2.south) S2.change('R');
    //printf("%d %d %d %d %d %d\n", S2.up, S2.south, S2.west, S2.east, S2.north, S2.down);

    if((S1.north==S2.north)&&(S1.south==S2.south)&&(S1.west==S2.west)&&(S1.east==S2.east)&&(S1.down==S2.down)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2700