def yes!; puts'Yes'; exit end
def no!; puts'No'; exit end

(N,),A,B = $<.map{|ln| ln.split.map(&:to_i) }

I = (0...N).sort_by{|i| B[i] }
LB = A.map{|a|
	I.bsearch_index{|i| a<=B[i] }||N
}
LB.sort.then{|lbs|
	no! unless lbs.each_with_index.all?{|lb,i| lb<=i }
	yes! if lbs.each_cons(2).any?(&:uniq!)
}

i,v,V = 0,0,[nil]*N
until V[i]
	V[i] = v+=1
	i = I[LB[i]]
end

v<N ? yes! : no!
