n=gets.to_i
all=[]
flag=[]
n.times.each do
    v=gets.split.map(&:to_i)
    all<<v
    if v[0]==v[1]
    flag<<1
    else
    flag<<0
    end
    
end

for i in 1..flag.length-2
    if flag[i-1]==flag[i] && flag[i]==flag[i+1]
        puts "Yes"
        exit
    end
    
end
puts "No"