num = gets.to_i
anum = []
bnum = []
count = 0
cou = num
num.times do |a|
  bnum[a] = gets.to_i
  anum[a] = gets.to_i
  bnum.sort!
  anum.sort!
  if (bnum[n]<anum[n]&&num==a)
    count = 1
   	break
  end
end

if count == 1
  puts 'No'
else
  puts 'Yes'
end
