n = $stdin.readline.to_i
d = Array.new(n) { $stdin.readline.chomp.split.map(&:to_i) }

res = []
(n - 2).times do |i|
  if d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] && d[i + 2][0] == d[i + 2][1]
    puts "Yes"
    exit
  end
end
puts "No"