
class Dice
  attr_reader :u, :f, :r, :l, :b, :d
  def initialize(line)
    @u, @f, @r, @l, @b, @d = line.split.map(&:to_i)
  end
  def rot(direc)
    case direc
    when "E";
      @u, @l, @d, @r = @l, @d, @r, @u
    when "N";
      @u, @f, @d, @b = @f, @d, @b, @u
    when "S";
      @u, @f, @d, @b = @b, @u, @f, @d
    when "W";
      @u, @l, @d, @r = @r, @u, @l, @d
    when "Z";
      @f, @r, @b, @l = @r, @b, @l, @f
    end
  end
  def dispUp
    printf "%d\n", @u
  end
  def arr
    {:u=>u, :f =>f, :r=>r, :l=>l, :b=>b, :d=>d}
  end
  def out
    return sprintf "%d %d %d %d %d %d", u, f, r, l, b, d
  end
end

dice1 = Dice.new(gets.chomp)
dice2 = Dice.new(gets.chomp)

dice2.arr.each{|key, val|
  if dice1.u == val then
    d2 = dice2.clone
    k = sprintf "%s", key
    case k
    when "d"; d2.rot("N"); d2.rot("N");
    when "f"; d2.rot("N");
    when "b"; d2.rot("S");
    when "l"; d2.rot("E");
    when "r"; d2.rot("W");
    end
    
    4.times do
      if dice1.out == d2.out then
        printf "Yes\n"
        exit
      end
      d2.rot("Z")
    end
  end
}

printf "No\n"