num = gets.to_i
anum = []
bnum = []
num.times do |a|
  bnum[a] = gets.to_i
  anum[a] = gets.to_i
end
bnum.sort!
anum.sort!
count = 0
num-2.times do |n|
  if (bnum[n]<anum[n])
    count = 1
   	break
  end
end
if count == 1
  puts 'No'
else
  puts 'Yes'
end