program answer
  implicit none
  integer(8) :: i, N, count
  integer(8) :: D(:,:)
  read(*,*) N
  allocate(D(N:2))
  do i = 1, n
     read(*,*) D(i,:)
  end do

  do i = 1, N-2
     if(D(i,1)==D(i,2).and.D(i+1,1)==D(i+1,2).and.D(i+2,1)==D(i+2,2)) then
        write(*,*) 'Yes'
        stop
     end if
  end do
  
  write(*,*) 'No'
  stop
 end program answer