#include <iostream>
using namespace std;
int dt1[10], dt2[10];

void left( int dt[] ) {
    int x = dt[1];
    dt[1] = dt[3];
    dt[3] = dt[6];
    dt[6] = dt[4];
    dt[4] = x;
}

void right( int dt[] ) {
    int x = dt[1];
    dt[1] = dt[4];
    dt[4] = dt[6];
    dt[6] = dt[3];
    dt[3] = x;
}

void up( int dt[] ) {
    int x = dt[1];
    dt[1] = dt[2];
    dt[2] = dt[6];
    dt[6] = dt[5];
    dt[5] = x;
}

void down( int dt[] ) {
    int x = dt[1];
    dt[1] = dt[5];
    dt[5] = dt[6];
    dt[6] = dt[2];
    dt[2] = x;
}

bool ok( int a[], int b[] ) {
    for( int i = 1; i <= 6; ++i ) if( a[i] != b[i] ) return false;
    return true;
}

bool check( int dt1[], int dt2[] ) {
    for( int i = 0; i < 4; ++i ) {
        left( dt1 );
        for( int j = 0; j < 4; ++j ) {
            up( dt1 );
            for( int k = 0; k < 4; ++k ) {
                left( dt1 );
                if( ok( dt1, dt2 ) ) return true;
            }
        }
    }
    return false;
}



int main( void ) {
    ios::sync_with_stdio( false );
    for( int i = 1; i <= 6; ++i ) cin >> dt1[i];
    for( int i = 1; i <= 6; ++i ) cin >> dt2[i];
    if( check( dt1, dt2 ) ) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}

