using System;

namespace ITP1_11_C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input1 = Console.ReadLine().Split(' ');
            string[] input2 = Console.ReadLine().Split(' ');
            int[] number1 = new int[6];
            int[] number2 = new int[6];

            for (int i = 0; i < 6; i++)
            {
                number1[i] = int.Parse(input1[i]);
                number2[i] = int.Parse(input2[i]);
            }
            Dice D1 = new Dice(number1);
            Dice D2 = new Dice(number2);

            string result = D1.Hantei(D2);
            Console.WriteLine(result);
        }
    }

    class Dice
    {
        public int[] D;
        public Dice(int[] data)
        {
            D = data;
        }
        public void Kaiten()
        {
            int D1, D2, D4, D3;
            D1 = this.D[1];
            D2 = this.D[2];
            D3 = this.D[3];
            D4 = this.D[4];
            this.D[1] = D2;
            this.D[2] = D4;
            this.D[4] = D3;
            this.D[3] = D1;
        }
        public void ToE()
        {
            int D0, D2, D5, D3;
            D0 = this.D[0];
            D2 = this.D[2];
            D3 = this.D[3];
            D5 = this.D[5];
            this.D[0] = D3;
            this.D[2] = D0;
            this.D[3] = D5;
            this.D[5] = D2;
        }
        public void ToN()
        {
            int D1, D0, D4, D5;
            D1 = this.D[1];
            D0 = this.D[0];
            D5 = this.D[5];
            D4 = this.D[4];
            this.D[0] = D1;
            this.D[1] = D5;
            this.D[4] = D0;
            this.D[5] = D4;
        }
        public void ToS()
        {
            int D1, D0, D4, D5;
            D1 = this.D[1];
            D0 = this.D[0];
            D5 = this.D[5];
            D4 = this.D[4];
            this.D[0] = D4;
            this.D[1] = D0;
            this.D[4] = D5;
            this.D[5] = D1;
        }
        public void ToW()
        {
            int D0, D2, D5, D3;
            D0 = this.D[0];
            D2 = this.D[2];
            D3 = this.D[3];
            D5 = this.D[5];
            this.D[0] = D2;
            this.D[2] = D5;
            this.D[5] = D3;
            this.D[3] = D0;
        }

        public string Hantei(Dice saikoro) 
        {

            string yes = "Yes";
            string no = "No";
            string result = null;

            int abc0 = saikoro.D[0]; //1
            int abc1 = saikoro.D[1]; //2
            int abc2 = saikoro.D[2]; //3
            int abc3 = saikoro.D[3]; //4
            int abc4 = saikoro.D[4]; //5
            int abc5 = saikoro.D[5]; //6

            if (this.D[0] == saikoro.D[0])
            {
                if (this.D[5] != saikoro.D[5])
                    result = no;
                if (this.D[5] == saikoro.D[5])
                {
                    while (true)
                    {
                        if (this.D[1] != saikoro.D[1])
                        {
                            saikoro.Kaiten();
                        }
                        if (this.D[1] == saikoro.D[1])
                            break;
                    }
                    if (this.D[4] != saikoro.D[4])
                        result = no;
                    if (this.D[4] == saikoro.D[4])
                    {
                        if (this.D[2] != saikoro.D[2])
                            result = no;
                        if (this.D[2] == saikoro.D[2])
                            result = yes;
                    }
                }
            }
            if (this.D[1] == saikoro.D[0])
            {
                if (this.D[4] != saikoro.D[5])
                    result = no;
                if (this.D[4] == saikoro.D[5])
                {
                    while (true)
                    {
                        if (this.D[5] != saikoro.D[1])
                        {
                            saikoro.Kaiten();
                        }
                        if (this.D[5] == saikoro.D[1])
                            break;
                    }
                    if (this.D[0] != saikoro.D[4])
                        result = no;
                    if (this.D[0] == saikoro.D[4])
                    {
                        if (this.D[2] != saikoro.D[2])
                            result = no;
                        if (this.D[2] == saikoro.D[2])
                            result = yes;
                    }
                }
            }
            if (this.D[2] == saikoro.D[0])
            {
                if (this.D[3] != saikoro.D[5])
                    result = no;
                if (this.D[3] == saikoro.D[5])
                {
                    while (true)
                    {
                        if (this.D[5] != saikoro.D[1])
                        {
                            saikoro.Kaiten();
                        }
                        if (this.D[5] == saikoro.D[1])
                            break;
                    }
                    if (this.D[0] != saikoro.D[4])
                        result = no;
                    if (this.D[0] == saikoro.D[4])
                    {
                        if (this.D[4] != saikoro.D[2])
                            result = no;
                        if (this.D[4] == saikoro.D[2])
                            result = yes;
                    }
                }
            }
            if (this.D[3] == saikoro.D[0])
            {
                if (this.D[2] != saikoro.D[5])
                    result = no;
                if (this.D[2] == saikoro.D[5])
                {
                    while (true)
                    {
                        if (this.D[5] != saikoro.D[1])
                        {
                            saikoro.Kaiten();
                        }
                        if (this.D[5] == saikoro.D[1])
                            break;
                    }
                    if (this.D[0] != saikoro.D[4])
                        result = no;
                    if (this.D[0] == saikoro.D[4])
                    {
                        if (this.D[1] != saikoro.D[2])
                            result = no;
                        if (this.D[1] == saikoro.D[2])
                            result = yes;
                    }
                }
            }
            if (this.D[4] == saikoro.D[0])
            {
                if (this.D[1] != saikoro.D[5])
                    result = no;
                if (this.D[1] == saikoro.D[5])
                {
                    while (true)
                    {
                        if (this.D[5] != saikoro.D[1])
                        {
                            saikoro.Kaiten();
                        }
                        if (this.D[5] == saikoro.D[1])
                            break;
                    }
                    if (this.D[0] != saikoro.D[4])
                        result = no;
                    if (this.D[0] == saikoro.D[4])
                    {
                        if (this.D[3] != saikoro.D[2])
                            result = no;
                        if (this.D[3] == saikoro.D[2])
                            result = yes;
                    }
                }
            }
            if (this.D[5] == saikoro.D[0])
            {
                if (this.D[0] != saikoro.D[5])
                    result = no;
                if (this.D[0] == saikoro.D[5])
                {
                    while (true)
                    {
                        if (this.D[1] != saikoro.D[1])
                        {
                            saikoro.Kaiten();
                        }
                        if (this.D[1] == saikoro.D[1])
                            break;
                    }
                    if (this.D[4] != saikoro.D[4])
                        result = no;
                    if (this.D[4] == saikoro.D[4])
                    {
                        if (this.D[3] != saikoro.D[2])
                            result = no;
                        if (this.D[3] == saikoro.D[2])
                            result = yes;
                    }
                }
            }
            return result;            
        }

    }
}


Measured memory_bytes: 7864