n = gets.to_i
d = n.times.map{gets.split.map(&:to_i)}
ans = false
(n-2).times do |i|
    f = true
    3.times do |j|
        f = false if d[i+j][0] != d[i+j][1]
    end
    ans = true if f
end
puts (ans ? "Yes" : "No")