using System;

class Program
{
    class DICE
    {
        public int top = 0;
        public int right = 0;
        int left = 0;
        int front = 0;
        public int back = 0;
        int bottom = 0;

        public DICE(string[] no) {
            top = int.Parse(no[0]);
            back = int.Parse(no[1]);
            right = int.Parse(no[2]);
            left = int.Parse(no[3]);
            front = int.Parse(no[4]);
            bottom = int.Parse(no[5]);
        }

        public bool Compare(DICE x) {
            for (int k = 0; k < 4; k++) {
                x.Move("E");
                for (int i = 0; i < 4; i++) {
                    x.TURN_LEFT();
                    if (IsSame(x)) { return true; }
                }
            }

            for (int k = 0; k < 4; k++) {
                x.Move("N");
                for (int i = 0; i < 4; i++) {
                    x.TURN_LEFT();
                    if (IsSame(x)) { return true; }
                }
            }

            return false;
        }

        private bool IsSame(DICE x) {
            if (top != x.top) { return false; }
            if (right != x.right) { return false; }
            if (left != x.left) { return false; }
            if (front != x.front) { return false; }
            if (back != x.back) { return false; }
            if (bottom != x.bottom) { return false; }
            return true;
        }

        public void Move(string mv) {
            for (int i = 0; i < mv.Length; i++) {
                string ch = mv.Substring(i, 1);
                if (ch == "N") {
                    MOVE_N();
                }
                else if (ch == "E") {
                    MOVE_E();
                }
                else if (ch == "W") {
                    MOVE_W();
                }
                else if (ch == "S") {
                    MOVE_S();
                }
            }
        }

        public bool Move(int setTop, int setBack) {
            if (setTop == right) { MOVE_W(); }
            if (setTop == left) { MOVE_E(); }
            if (setTop == front) { MOVE_S(); }
            if (setTop == back) { MOVE_N(); }
            if (setTop == bottom) { MOVE_N(); MOVE_N(); }

            if (setBack == right) { TURN_RIGHT(); }
            if (setBack == left) { TURN_LEFT(); }
            if (setBack == front) { TURN_RIGHT(); TURN_RIGHT(); }

            if ((setTop == top) && (setBack == back)) {
                return true;
            }

            return false;
        }

        private void TURN_RIGHT() {
            int wk = front;
            front = left;
            left = back;
            back = right;
            right = wk;
        }

        private void TURN_LEFT() {
            int wk = front;
            front = right;
            right = back;
            back = left;
            left = wk;
        }

        private void MOVE_N() {
            int wk = top;
            top = back;
            back = bottom;
            bottom = front;
            front = wk;
        }

        private void MOVE_E() {
            int wk = top;
            top = left;
            left = bottom;
            bottom = right;
            right = wk;
        }

        private void MOVE_W() {
            int wk = top;
            top = right;
            right = bottom;
            bottom = left;
            left = wk;
        }

        private void MOVE_S() {
            int wk = top;
            top = front;
            front = bottom;
            bottom = back;
            back = wk;
        }
    }

    static void Main(string[] args) {
        string[] x = Console.ReadLine().Split(' ');
        string[] y = Console.ReadLine().Split(' ');

        DICE xD = new DICE(x);
        DICE yD = new DICE(y);

        if (xD.Compare(yD)) { Console.WriteLine("Yes"); }
        else { Console.WriteLine("No"); }
    }
}


Measured memory_bytes: 18024