lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]

num = 0
num_max = 0
for i in 1..N do
  if lines[i][0] == lines[i][1] then
    num += 1
  else
    num = 0
  end
  if num > num_max then
    num_max = num
  end
end
    
if num_max >= 3 then
  puts "Yes"
else
  puts "No"
end