class Dice
  def initialize (a, b, c, d, e, f)
     @dice = [a, b, c, d, e, f]
  end


def move(command)
  case command
  when "N" then @dice[0], @dice[1], @dice[5], @dice[4] = @dice[1], @dice[5], @dice[4], @dice[0]
  when "S" then @dice[0], @dice[1], @dice[5], @dice[4] = @dice[4], @dice[0], @dice[1], @dice[5]
  when "E" then @dice[0], @dice[2], @dice[5], @dice[3] = @dice[3], @dice[0], @dice[2], @dice[5]
  when "W" then @dice[0], @dice[2], @dice[5], @dice[3] = @dice[2], @dice[5], @dice[3], @dice[0]
  end
end
 
d1 = gets.split(" ").map{|i| i.to_i}
d2 = gets.split(" ").map{|i| i.to_i}
 
yn = false   
for i in 1..6
  d = Marshal.load(Marshal.dump(d2))
  case i
  when 2 then d = move("S")
  when 3 then d = move(move("W"),"S")
  when 4 then d = move("N")
  when 5 then d = move(move("E"),"S")
  when 6 then d = move(move("S"),"S")
  end
  for j in 0..4
    d = move("W")
    yn = (yn || d == d1)
  end
end
 
puts(yn ? "Yes" : "No")
