def ja;  puts'Yes'; exit end
def nein; puts'No'; exit end

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

IA = (0...N).sort_by{|i| A[i] }
IB = (0...N).sort_by{|i| B[i] }

nein unless (0...N).all?{|i| A[IA[i]] <= B[IB[i]]  }
ja if (1...N).any?{|i| A[IA[i]] <= B[IB[i-1]] }

IIB = [nil]*N
IB.each_with_index{|i,j|
	IIB[i] = j
}

i,v,V = IA[0],0,[nil]*N
until V[i]
	V[i] = v+=1
	i = IA[IIB[i]]
end

v<N ? ja : nein
