#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define each(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define vd vector<double>
#define vvd vector<vd>
#define vvvd vector<vvd>
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

// inline void fastio() { ios::sync_with_stdio(false), cin.tie(0); }
/******* Variable ************************************/
const int maxn = 1e6 * 50;
const int inf = 1e9 + 7;
const double pi = 3.141592653589;
/******* Function ************************************/
class dice
{
 public:
  int s1[10];
  void roll(char dir)
  {
    int tmp1[10];

    memcpy(tmp1, s1, sizeof(int) * 10);
    switch (dir)
    {
      case 'N':
        s1[1] = tmp1[2];
        s1[2] = tmp1[6];
        s1[6] = tmp1[5];
        s1[5] = tmp1[1];
        break;
      case 'E':
        s1[1] = tmp1[4];
        s1[4] = tmp1[6];
        s1[6] = tmp1[3];
        s1[3] = tmp1[1];
        break;
      case 'W':
        s1[1] = tmp1[3];
        s1[3] = tmp1[6];
        s1[6] = tmp1[4];
        s1[4] = tmp1[1];
        break;
      case 'S':
        s1[1] = tmp1[5];
        s1[5] = tmp1[6];
        s1[6] = tmp1[2];
        s1[2] = tmp1[1];
        break;
      case 'R':
        s1[2] = tmp1[3];
        s1[3] = tmp1[5];
        s1[5] = tmp1[4];
        s1[4] = tmp1[2];
        break;
    }
    return;
  }
  void roll(int x)
  {
    switch (x)
    {
      case 1:
        break;
      case 2:
        roll('N');
        break;
      case 3:
        roll('W');
        break;
      case 4:
        roll('E');
        break;
      case 5:
        roll('S');
        break;
      case 6:
        roll('N');
        roll('N');
        break;
    }
    return;
  }
};

bool comp(dice d1, dice d2)
{
  for (int i = 1; i <= 6; i++)
    if (d1.s1[i] != d2.s1[i]) return false;
  return true;
}

/******* Main ****************************************/
void Main()
{
  dice d1, d2;
  rep(i, 1, 7)
  {
    cin >> d1.s1[i];
  }
  rep(i, 1, 7)
  {
    cin >> d2.s1[i];
  }

  dice tmp1 = d1;

  rep(i, 1, 7)
  {
    d1 = tmp1;
    d1.roll(i);
    rep(i, 0, 4)
    {
      d1.roll('R');
      if (comp(d1, d2))
      {
        puts("Yes");
        return;
      }
    }
  }
  puts("No");
}
/******************************************************
  Smaile!
▕▔╲┊┊┊┊┊┊┊┊┊╱▔▏
┊╲┈╲╱▔▔▔▔▔╲╱┈╱┊
┊┊╲┈╭╮┈┈┈╭╮┈╱┊┊
┊┊╱┈╰╯┈▂┈╰╯┈╲┊┊
┊┊▏╭╮▕━┻━▏╭╮▕┊┊
┊┊╲╰╯┈╲▂╱┈╰╯╱
                    How`s it going?
                            |＼
                    　／￣＼　ヽ
                    ／　　　ヽ |_
                    ￣＼　　　　 ＼
                    ／￣　/|/| /ﾚ､ ヽ＿
                    ￣＼ Yヘ |/ヘ幺　∠
                    　＜_|(･> <･) 6) ／
                      　　 (ﾞ　_　ﾞ／＜
                      　　　＞､ーイ￣￣
                    　　／厂ヽ／￣/＼
                    　 ( ｜　(亀)(>　)▏

                            Take a rest before getting tired!
                                        　　 ●
                                        　　/⌒ヽ
                                        　 ｜ 　|/⌒ヽ(ヽ
                                        　 (｀　∥ー⌒) |
                                        　|￣||￣￣￣￣￣|
                                        　|―||―――――|
                                        　|　Ｕ　　　　　|
                                        　|￣￣￣￣￣￣￣|
                                        　|＿＿＿＿＿＿＿|
                                        　　|―――――|
                                        　　|―――――|
                                        ｗｗＷｗｗＷｗＷＷｗ

******************************************************/
int main()
{
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 3116