Module Program
    Sub Main(args As String())
        Dim N = Integer.Parse(Console.ReadLine())
        Dim D = Enumerable.Range(0, N).Select(Function(i) Console.ReadLine()).Select(Function(i) i(0) = i(2)).ToList()

        For i As Integer = 2 To N - 1
            If D(i - 2) And D(i - 1) And D(i) Then
                Console.WriteLine("Yes")
                Return
            End If
        Next
        Console.WriteLine("No")
    End Sub
End Module
