n = gets.to_i
array = []
while string = gets
  array << string.chomp.split.map(&:to_i)
end
s = 0
for i in 0..n-3
  if array[i][0]==array[i][1] && array[i+1][0]==array[i+1][1] && array[i+2][0]==array[i+2][1]
    s = 1
  end
end
if s == 1
  puts "Yes"
else
  puts "No"
end

