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

main = do
  (n:m:_) <- getLine >>= return . (map read) . words :: IO [Int]
  dat <- getContents >>= return . (map ((map read) . words)) . lines :: IO [[Int]]
  arr <- newArray (2,n-1) (False,False) :: IO (IOArray Int (Bool,Bool))
  ch <- newIORef False :: IO (IORef Bool)

  forM_ dat $ \(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)

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

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