class Dice
	attr_accessor :t, :b, :n, :e, :s, :w
	def initialize(*labels)
		@t = labels[0]
		@s = labels[1]
		@e = labels[2]
		@w = labels[3]
		@n = labels[4]
		@b = labels[5]
	end
	def roll(dir)
		case dir
		when 'N'
			@t, @s, @b, @n = @s, @b, @n, @t
		when 'S'
			@s, @b, @n, @t = @t, @s, @b, @n
		when 'W'
			@t, @e, @b, @w = @e, @b, @w, @t
		when 'E'
			@e, @b, @w, @t = @t, @e, @b, @w
		end
	end
	def set_position!(t, s)
		8.times{|i|
			break if @s == s
			roll 'NW'[i%4/3]
		}
		roll 'W' while @t != t
	end
	def labels
		[@t, @s, @e, @w, @n, @b].sort
	end
	def ==(other)
		@t == other.t && @s == other.s && @e == other.e && @w == other.w && @n == other.n && @b == other.b
	end
end

dice1 = Dice.new(*gets.split)
dice2 = Dice.new(*gets.split)
message = "No"
if dice1.labels == dice2.labels
	dice2.set_position! dice1.t, dice1.s
	if dice1 == dice2
		message = "Yes"
	end
end
puts message