$n = gets.chomp.to_i
$ans = 0
$cur = 0
$n.times do |i|
  a = gets.split(" ")
  i0 = a[0].to_i
  i1 = a[1].to_i
  if i0 == i1 
    $cur += 1
  else
    if $cur > $ans 
      $ans = $cur 
    end
    $cur = 0
  end
end

if $cur > $ans 
  $ans = $cur 
end

if $ans > 2
  print "Yes"
else
  print "No"
end