using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    public class Dice
    {
        public int[] Face {get; set;}
        public Dice Nua(char dir)
        {
            int[] _f = Face.Clone() as int[];
            var f = Face;
            Face = _f;
            switch (dir)
            {
                case 'N':
                {
                    Face[0] = f[1];
                    Face[1] = f[5];
                    Face[5] = f[4];
                    Face[4] = f[0];
                }
                break;
                case 'E':
                {
                    Face[2] = f[0];
                    Face[0] = f[3];
                    Face[3] = f[5];
                    Face[5] = f[2];
                }
                break;
                case 'W':
                {
                    Face[3] = f[0];
                    Face[0] = f[2];
                    Face[2] = f[5];
                    Face[5] = f[3];
                }
                break;
                case 'S':
                {
                    Face[1] = f[0];
                    Face[5] = f[1];
                    Face[4] = f[5];
                    Face[0] = f[4];
                }
                break;
            }
            _f = Face;
            Face = f;
            return new Dice { Face = _f};
        }
        public override bool Equals(Object obj) 
        {
            var o = obj as Dice;
            if (o == null)
                return false;
            return Enumerable.SequenceEqual(Face, o.Face);
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
    static void Main(string[] args)
    {
        var aid = new Dice { Face = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray()};
        var k = 1;
        for (int i = 0; i < k; i++)
        {
            var aif = new Dice { Face = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray()};
            var bf = false;
            //5^4 = 625
            foreach (var f0 in "_NSWE")
            {
                if (bf)
                    break;
                foreach (var f1 in "_NSWE")
                {
                    if (bf)
                        break;
                    foreach (var f2 in "_NSWE")
                    {
                        if (bf)
                            break;
                        foreach (var f3 in "_NSWE")
                        {
                            var rolled = aid.Nua(f0).Nua(f1).Nua(f2).Nua(f3);
                            if (rolled.Equals(aif))
                            {
                                Console.WriteLine("Yes");
                                bf = true;
                                break;
                            }    
                        }
                    }
                }
            }
            if (!bf)
                Console.WriteLine("No");
        }
    }
}
















































































































































































































































































































































































































































































































































































































































































































































































Measured memory_bytes: 9884