import Data.Array.IO
import Data.List
import Data.IORef
import Control.Monad

main = do
  (n:m:_) <- getLine >>= return . (map read) . words :: IO [Int]
  arr <- newArray (2,n-1) (False,False) :: IO (IOArray Int (Bool,Bool))
  ch <- newIORef False :: IO (IORef Bool)
  
  let
    g = \(a:b:_) -> do
      when (a==1) $ do
        (x,y) <- readArray arr b
        writeArray arr b (True, y)
        when y (writeIORef ch True)
      when (b==n) $ do
        (x,y) <- readArray arr a
        writeArray arr a (x, True)
        when x (writeIORef ch True)

  replicateM m (getLine >>= g . (map read) . words)

  putStrLn =<< return . func =<< readIORef ch

  where
    func False = "IMPOSSIBLE"
    func True = "POSSIBLE"
