using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        enum Directoin
        {
            N,
            E,
            W,
            S,
            U,
            D,
        }

        class Pair
        {
            public int Value { get; set; }
            public Directoin Dir { get; set; }
        }

        class Dice
        {
            private int[] nums = new int[6];
            private List<Directoin> dirs;
            public Dice(IEnumerable<int> nums)
            {
                this.nums = nums.ToArray();
                dirs = new List<Directoin>()
                {
                    Directoin.U,
                    Directoin.S,
                    Directoin.E,
                    Directoin.W,
                    Directoin.N,
                    Directoin.D,
                };
            }
            public void Roll(Directoin roll)
            {
                switch (roll)
                {
                    case Directoin.N:
                        for (int i = 0; i < dirs.Count; i++)
                        {
                            switch (dirs[i])
                            {
                                case Directoin.N:
                                    dirs[i] = Directoin.D;
                                    break;
                                case Directoin.E:
                                    break;
                                case Directoin.W:
                                    break;
                                case Directoin.S:
                                    dirs[i] = Directoin.U;
                                    break;
                                case Directoin.U:
                                    dirs[i] = Directoin.N;
                                    break;
                                case Directoin.D:
                                    dirs[i] = Directoin.S;
                                    break;
                                default:
                                    break;
                            }
                        }
                        break;
                    case Directoin.E:
                        for (int i = 0; i < dirs.Count; i++)
                        {
                            switch (dirs[i])
                            {
                                case Directoin.N:
                                    break;
                                case Directoin.E:
                                    dirs[i] = Directoin.D;
                                    break;
                                case Directoin.W:
                                    dirs[i] = Directoin.U;
                                    break;
                                case Directoin.S:
                                    break;
                                case Directoin.U:
                                    dirs[i] = Directoin.E;
                                    break;
                                case Directoin.D:
                                    dirs[i] = Directoin.W;
                                    break;
                                default:
                                    break;
                            }
                        }
                        break;
                    case Directoin.W:
                        for (int i = 0; i < dirs.Count; i++)
                        {
                            switch (dirs[i])
                            {
                                case Directoin.N:
                                    break;
                                case Directoin.E:
                                    dirs[i] = Directoin.U;
                                    break;
                                case Directoin.W:
                                    dirs[i] = Directoin.D;
                                    break;
                                case Directoin.S:
                                    break;
                                case Directoin.U:
                                    dirs[i] = Directoin.W;
                                    break;
                                case Directoin.D:
                                    dirs[i] = Directoin.E;
                                    break;
                                default:
                                    break;
                            }
                        }
                        break;
                    case Directoin.S:
                        for (int i = 0; i < dirs.Count; i++)
                        {
                            switch (dirs[i])
                            {
                                case Directoin.N:
                                    dirs[i] = Directoin.U;
                                    break;
                                case Directoin.E:
                                    break;
                                case Directoin.W:
                                    break;
                                case Directoin.S:
                                    dirs[i] = Directoin.D;
                                    break;
                                case Directoin.U:
                                    dirs[i] = Directoin.S;
                                    break;
                                case Directoin.D:
                                    dirs[i] = Directoin.N;
                                    break;
                                default:
                                    break;
                            }
                        }
                        break;
                    default:
                        break;
                }
            }
            public void Rotate(Directoin rotate)
            {
                switch (rotate)
                {
                    case Directoin.E:
                        for (int i = 0; i < dirs.Count; i++)
                        {
                            switch (dirs[i])
                            {
                                case Directoin.N:
                                    dirs[i] = Directoin.E;
                                    break;
                                case Directoin.E:
                                    dirs[i] = Directoin.S;
                                    break;
                                case Directoin.W:
                                    dirs[i] = Directoin.N;
                                    break;
                                case Directoin.S:
                                    dirs[i] = Directoin.W;
                                    break;
                                case Directoin.U:
                                case Directoin.D:
                                default:
                                    break;
                            }
                        }
                        break;
                    case Directoin.W:
                        for (int i = 0; i < dirs.Count; i++)
                        {
                            switch (dirs[i])
                            {
                                case Directoin.N:
                                    dirs[i] = Directoin.W;
                                    break;
                                case Directoin.E:
                                    dirs[i] = Directoin.N;
                                    break;
                                case Directoin.W:
                                    dirs[i] = Directoin.S;
                                    break;
                                case Directoin.S:
                                    dirs[i] = Directoin.E;
                                    break;
                                case Directoin.U:
                                case Directoin.D:
                                default:
                                    break;
                            }
                        }
                        break;
                    default:
                        break;
                }
            }
            public int Getnum(Directoin dir)
            {
                return nums[dirs.IndexOf(dir)];
            }
            public override int GetHashCode()
            {
                var result = 17;
                foreach (var dir in Enum.GetValues(typeof(Directoin)).Cast<Directoin>())
                {
                    result = 100 * result + Getnum(dir);
                }
                return result;
            }
            public override bool Equals(object obj)
            {
                if (obj == null)
                {
                    return false;
                }
                var c = obj as Dice;
                if (c == null)
                {
                    return false;
                }
                return GetHashCode() == c.GetHashCode();
            }
        }

        static void Main(string[] args)
        {
            var nums1 = GetNumbersInt();
            var nums2 = GetNumbersInt();
            var rolls = new[]
            {
                Directoin.S,
                Directoin.S,
                Directoin.S,
                Directoin.S,
                Directoin.W,
                Directoin.W,
                Directoin.W,
            };
            var rotates = new[]
            {
                Directoin.W,
                Directoin.W,
                Directoin.W,
                Directoin.W
            };

            var dice1 = new Dice(nums1);
            var dice2 = new Dice(nums2);

            var top = dice2.Getnum(Directoin.U);
            foreach (var roll in rolls)
            {
                dice1.Roll(roll);
                if (dice1.Getnum(Directoin.U) == top)
                {
                    break;
                }
            }
            foreach (var rotate in rotates)
            {
                dice1.Rotate(rotate);
                if (dice1.Equals(dice2))
                {
                    System.Console.WriteLine("Yes");
                    return;
                }
            }

            System.Console.WriteLine("No");
        }

        //static StreamReader Console = new StreamReader("input.txt");

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static int[] GetNumbersInt(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static long[] GetNumbersLong(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();
        }

        static double[] GetNumbersDouble(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => double.Parse(x)).ToArray();
        }

        static string[] GetStrings(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToArray();
        }
    }
}

Measured memory_bytes: 10124