program prob4
    implicit none
    integer, allocatable::c(:,:), p(:), nn(:)
    integer::n, m, i, j
    read(*,*) n, m
    allocate(c(m,2),p(n),nn(n))
    do i = 1, m
        read(*,*) c(i,:)
    end do

    p = 0
    nn = 0
    do i = 1, m
        if(c(i,1) == 1) then
            p(c(i,2)) = 1
        else if(c(i,2) == n) then
            nn(c(i,1)) = 1
        end if
    end do
    if(nn(1) == 1) then
        write(*,'(a)') "POSSIBLE"
        stop
    else
        do i = 2, n
            if(nn(i) == 1 .and. p(i) == 1) then
                write(*,'(a)') "POSSIBLE"
                stop
            end if
        end do
    end if
    write(*,'(a)') "IMPOSSIBLE"
    stop
end program