n = gets.chomp.to_i
count = 0
arr = []
n.times do 
    x, y = gets.chomp.split(" ").map(&:to_i)
    if x == y
        count += 1
    else
        arr << count
        count = 0
    end
end
arr << count
arr.each do |i|
    if i >= 3
        puts "Yes"
        exit
    end
end
puts "No"