      program BBB
!
      implicit none
      integer :: N
      integer :: i
      integer,dimension(100,2) :: D
      integer :: count
      integer :: jud
!
      count = 0
      jud = 0
!
      read(*,*) N
      do i=1,N
        read(*,*) D(i,1),D(i,2)
        if(D(i,1) == D(i,2)) then
          count = count + 1
        else
          count = 0
        end if
        if(count == 3) then 
          jud = 1
        end if
      end do
!
      if(jud == 1) then 
         write(*,*) 'Yes'
      else 
         write(*,*) 'No'
      end if
!
      end program BBB