n = gets.to_i
a = Array.new(n) { b = gets.split.map(&:to_i); b[0] == b[1] }
flag = false
(2...(a.size)).each do |i|
  if a[i] && a[i-1] && a[i-2]
    flag = true
    break
  end
end
puts flag  ? "Yes" : "No"