gets
a=gets.split.map &:to_i
Z={}
r=[]
gets.split.each{|e|
	n=e.to_i
	next if Z[n]
	while a[0]
		v=a.shift
		Z[v]=1
		break if v==n
	end
	break if v!=n
	r<<n
}
p *r.sort