using System;

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var labelsA = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            var labelsB = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            var diceA = new Dice(labelsA);
            var diceB = new Dice(labelsB);
            const string Yes = "Yes";
            const string No = "No";
            for (int x = 0; x < 4; x++)
            {
                for (int y = 0; y < 4; y++)
                {
                    for (int z = 0; z < 4; z++)
                    {
                        if (IsEqualDice(diceA, diceB))
                        {
                            Console.WriteLine(Yes);
                            return;
                        }
                        diceB.RollZ(true);
                    }
                    diceB.RollY(true);
                }
                diceB.RollX(true);
            }
            Console.WriteLine(No);
        }

        private static bool IsEqualDice(Dice diceA, Dice diceB)
        {
            if (diceA.Front != diceB.Front) return false;
            else if (diceA.Bottom != diceB.Bottom) return false;
            else if (diceA.Right != diceB.Right) return false;
            else if (diceA.Left != diceB.Left) return false;
            else if (diceA.Top != diceB.Top) return false;
            else if (diceA.Rear != diceB.Rear) return false;
            else return true;
        }
        
    }

    class Dice
    {
        public int Front { get; private set; }
        public int Bottom { get; private set; }
        public int Right { get; private set; }
        public int Left { get; private set; }
        public int Top { get; private set; }
        public int Rear { get; private set; }

        public Dice(int[] label)
        {
            Front = label[0];
            Bottom = label[1];
            Right = label[2];
            Left = label[3];
            Top = label[4];
            Rear = label[5];
        }

        public void RollX(bool direction)
        {
            var temp = 0;
            if (direction)
            {
                temp = Front;
                Front = Left;
                Left = Rear;
                Rear = Right;
                Right = temp;
            }
            else
            {
                temp = Front;
                Front = Right;
                Right = Rear;
                Rear = Left;
                Left = temp;
            }
        }
        public void RollY(bool direction)
        {
            var temp = 0;
            if (direction)
            {
                temp = Front;
                Front = Bottom;
                Bottom = Rear;
                Rear = Top;
                Top = temp;
            }
            else
            {
                temp = Front;
                Front = Top;
                Top = Rear;
                Rear = Bottom;
                Bottom = temp;
            }
        }
        public void RollZ(bool direction)
        {
            var temp = 0;
            if (direction)
            {
                temp = Top;
                Top = Left;
                Left = Bottom;
                Bottom = Right;
                Right = temp;
            }
            else
            {
                temp = Top;
                Top = Right;
                Right = Bottom;
                Bottom = Left;
                Left = temp;
            }
        }
    }
}

Measured memory_bytes: 13460