N = gets.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
Ah = A.tally
Bh = B.tally
(puts'No'; exit) if Bh.any?{|b,n| N-(Ah[b]||0)<n }

As = Ah.sort_by{|a,n| -n }
Bs = Bh.sort_by{|b,n| -n }
C = [nil]*N
As.each{|a,an|
	ai = A.bsearch_index{|_| a<=_ }
	(0...Bs.size).each{|bi|
		b,bn = Bs[bi]
		if b != a
			n = [an,bn].min
			C.fill(b,ai,n)
			ai += n
			bn -= n
			an -= n
			Bs[bi] = [b,bn]
			break if an < 1
		end
	}
}
puts'Yes'
puts C*' '
