
Imports System.Console
Module Module1
    Dim w As Int64
    Dim ii, iii As Int64
    Dim ans As Int64
    Dim md As Int64 = (10 ^ 9) + 7
    Dim max, min As Int64
    Dim n, k, x, t, d, m As Int64
    Sub Add(ByRef arr() As Integer, ByVal num As Integer)
        If arr Is Nothing Then
            ReDim arr(0)
            arr(0) = num
        Else
            ReDim Preserve arr(arr.Length)
            arr(arr.Length - 1) = num
        End If
    End Sub
    Sub Main()
        n = ReadLine()
        Dim d1(n), d2(n) As Integer
        Dim cout As Integer
        Dim b As Boolean
        For i = 1 To n
            Dim s() As String = ReadLine().Split
            d1(i) = s(0)
            d2(i) = s(1)
            If d1(i) = d2(i) Then
                cout += 1
            Else
                cout = 0
            End If
            If cout >= 3 Then
                b = True
            End If
        Next
        If b Then
            WriteLine("Yes")
        Else
            WriteLine("No")
        End If
        'WriteLine(ans)
        ReadLine()
    End Sub
End Module
