program sample
    implicit none
    character(100)::s
    integer(8) :: i,j,m,n,a,b
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,m
    allocate(x(n),y(n))
    x(:)=0
    y(:)=0
    do i=1,m
        read(*,*)a,b
        if(a==1)then
            x(b)=1
        elseif(b==n)then
            y(a)=1
        end if
    end do
    a=dot_product(x,y)
    if(a>0)then
        write(*,*)'POSSIBLE'
    else
        write(*,*)'IMPOSSIBLE'
    end if
    stop
end program sample
  

