class Dice:	
	def __init__( self, nums ):
		self.face = nums
	
	def rolltoTopIndex( self, faceindex ):	
		if faceindex == 1:
			self.roll( "N" )
		elif faceindex == 2:
			self.roll( "W" )
		elif faceindex == 3:
			self.roll( "E" )
		elif faceindex == 4:
			self.roll( "S" )
		elif faceindex == 5:
			self.roll( "NN" )
	
	def roll( self, actions ):
		for act in actions:
			t = 0
			if act == "E":
				t =   self.face[0]
				self.face[0] =   self.face[3]
				self.face[3] =   self.face[5]
				self.face[5] =   self.face[2]
				self.face[2] = t
			elif  act == "N":
				t =   self.face[0]
				self.face[0] =   self.face[1]
				self.face[1] =   self.face[5]
				self.face[5] =   self.face[4]
				self.face[4] = t
			elif  act == "S":
				t =  self.face[ 0]
				self.face[0] =  self.face[4]
				self.face[4] =  self.face[5]
				self.face[5] =  self.face[1]
				self.face[1] = t	
			elif  act == "W":
				t =  self.face[0]
				self.face[0] =  self.face[2]
				self.face[2] =  self.face[5]
				self.face[5] =  self.face[3]
				self.face[3] = t	
			elif  act == "M":
				t =  self.face[1]
				self.face[1] =  self.face[2]
				self.face[2] =  self.face[4]
				self.face[4] =  self.face[3]
				self.face[3] = t

diceface = [ int( val ) for val in input( ).split( " " ) ]
dice1 = Dice( diceface )
diceface = [ int( val ) for val in input( ).split( " " ) ]
dice2 = Dice( diceface )


cnt = 0
for i in range( 6 ):
	if dice1.face[0] == dice2.face[i]:
		dice2.rolltoTopIndex( i )
		for j in range( 1, 5 )
			if dice1.face[1] == dice2.face[1]:
				cnt = 0
				for k in range( 6 ):
					if dice1.face[k] == dice2.face[k]:
						cnt += 1
				if cnt == 6
					break
			dice2.roll( "M" )
	if cnt == 6
		break
	dice2.face = diceface


if cnt == 6:
	print( "Yes" )
else:
	print( "No" )

### FIXED CODE ###

class Dice:	
	def __init__( self, nums ):
		self.face = nums
	
	def rolltoTopIndex( self, faceindex ):	
		if faceindex == 1:
			self.roll( "N" )
		elif faceindex == 2:
			self.roll( "W" )
		elif faceindex == 3:
			self.roll( "E" )
		elif faceindex == 4:
			self.roll( "S" )
		elif faceindex == 5:
			self.roll( "NN" )
	
	def roll( self, actions ):
		for act in actions:
			t = 0
			if act == "E":
				t =   self.face[0]
				self.face[0] =   self.face[3]
				self.face[3] =   self.face[5]
				self.face[5] =   self.face[2]
				self.face[2] = t
			elif  act == "N":
				t =   self.face[0]
				self.face[0] =   self.face[1]
				self.face[1] =   self.face[5]
				self.face[5] =   self.face[4]
				self.face[4] = t
			elif  act == "S":
				t =  self.face[ 0]
				self.face[0] =  self.face[4]
				self.face[4] =  self.face[5]
				self.face[5] =  self.face[1]
				self.face[1] = t	
			elif  act == "W":
				t =  self.face[0]
				self.face[0] =  self.face[2]
				self.face[2] =  self.face[5]
				self.face[5] =  self.face[3]
				self.face[3] = t	
			elif  act == "M":
				t =  self.face[1]
				self.face[1] =  self.face[2]
				self.face[2] =  self.face[4]
				self.face[4] =  self.face[3]
				self.face[3] = t

diceface = [ int( val ) for val in input( ).split( " " ) ]
dice1 = Dice( diceface )
diceface = [ int( val ) for val in input( ).split( " " ) ]
dice2 = Dice( diceface )


cnt = 0
for i in range( 6 ):
	if dice1.face[0] == dice2.face[i]:
		dice2.rolltoTopIndex( i )
		for j in range( 1, 5 ):
			if dice1.face[1] == dice2.face[1]:
				cnt = 0
				for k in range( 6 ):
					if dice1.face[k] == dice2.face[k]:
						cnt += 1
				if cnt == 6:
					break
			dice2.roll( "M" )
	if cnt == 6:
		break
	dice2.face = diceface


if cnt == 6:
	print( "Yes" )
else:
	print( "No" )