#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>

void roll(std::vector<int> &v, char c) {
    if (c == 'E') {
        char tmp = v[0];
        v[0] = v[3];
        v[3] = v[5];
        v[5] = v[2];
        v[2] = tmp;
    } else if (c == 'S') {
        char tmp = v[0];
        v[0] = v[4];
        v[4] = v[5];
        v[5] = v[1];
        v[1] = tmp;
    } else if (c == 'N') {
        char tmp = v[0];
        v[0] = v[1];
        v[1] = v[5];
        v[5] = v[4];
        v[4] = tmp;
    } else {
        char tmp = v[0];
        v[0] = v[2];
        v[2] = v[5];
        v[5] = v[3];
        v[3] = tmp;
    }
}

int main(){
    std::vector<int> v(6), v2(6);
    for (int i = 0; i < 6; i++) {
        std::cin >> v[i];
    }
    for (int i = 0; i < 6; i++) {
        std::cin >> v2[i];
    }

    if (v[1] != v2[1]) {
        if (v2[4] == v[1]) roll(v2, 'N');
        while (v2[0] != v[1]) roll(v2, 'E');
        roll(v2, 'S');
    }

    for (int i = 0; i < 4; i++) {
        if (v == v2) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
        roll(v2, 'E');
    }
    std::cout << "No" << std::endl;

    return 0;
}