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] }
A’ = IA.map{|i| A[i] }
B’ = IB.map{|i| B[i] }
p A’
p B’
nein unless (0...N).all?{|i| A’[i]<=B’[i]  }
ja if (1..N-1).any?{|i| A’[i]<=B’[i-1] }

visited, ia = [nil]*N, 0
until visited[ia]
	visited[ia] = 1
	ib = IB[ia]
	ia = IA[ib]
end
visited.any?(&:nil?) ? ja : nein
