n = gets.chomp.to_i
d = n.times.map{gets.split.map(&:to_i)}

count=0
flag=0
for i in 0..n-1
  if(d[i][0]==d[i][1])
    count+=1
  else
    count=0
  end
  if count>=3
    flag=1
  end
end

if flag==1
  puts "Yes"
else
  puts "No"
end