io = DATA.eof? ? STDIN : DATA
n=io.gets.to_i
ar=n.times.map do
  a,b=io.gets.split.map(&:to_i)
  a==b
end
chunk=ar.chunk_while{|a,b|a==b}.to_a
puts chunk.any?{|a|a.size>=3&&a[0]==true} ? "Yes" : "No"

__END__
