program main
    implicit none
    integer n,i
    integer,allocatable :: D(:,:)

    read(*,*)n
    allocate(D(1:n,1:2))
    do i=1,n
        read(*,*)D(i,1:2)
    enddo
    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"
            RETURN
        endif
    enddo
    write(*,*)"No"
end program main