let read_ns () = Scanf.scanf "%d %d " (fun x y -> (x, y))

let bfs g goal =
  let que = Queue.create () in
  Queue.push 0 que;
  let rec doit depth reach_p =
    if reach_p && depth <= 2 then "POSSIBLE"
    else if Queue.is_empty que || depth > 2 then "IMPOSSIBLE"
    else begin
      let n = Queue.pop que in
      let p = ref false in
      List.iter (fun e ->
        Queue.push e que; if e = goal then p := true)
        g.(n);
      doit (depth + 1) !p
    end in
  doit 0 false

let () =
  let (n, m) = read_ns () in
  let g = Array.make n [] in
  for _ = 0 to m - 1 do
    let (a, b) = read_ns () in
    let (a, b) = (a - 1, b - 1) in
    g.(a) <- b :: g.(a);
    g.(b) <- a :: g.(b);
  done;
  bfs g (n - 1) |> print_endline