import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine

getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine

getNum :: [[Int]] -> Int -> [Int] -> [Int] -> String
getNum [] n as bs = "IMPOSSIBLE"
getNum (xy : xys) n as bs
  | h == 1 && l `elem` bs = "POSSIBLE"
  | h == 1 = getNum xys n (l : as) bs
  | l == 1 && h `elem` bs = "POSSIBLE"
  | l == 1 = getNum xys n (h : as) bs
  | h == n && l `elem` as = "POSSIBLE"
  | h == n = getNum xys n as (l : bs)
  | l == n && h `elem` as = "POSSIBLE"
  | l == n = getNum xys n as (h : bs)
  | otherwise = getNum xys n as bs
  where
    h = head xy
    l = last xy

main = do
  [n, m] <- getIntList
  abs <- getIntNList m
  putStrLn $ getNum abs n [] []
