atcoder#ARC079A. [ABC068C] Cat Snuke and a Voyage

[ABC068C] Cat Snuke and a Voyage

Score : 300300 points

Problem Statement

In Takahashi Kingdom, there is an archipelago of NN islands, called Takahashi Islands. For convenience, we will call them Island 11, Island 22, ..., Island NN.

There are MM kinds of regular boat services between these islands. Each service connects two islands. The ii-th service connects Island aia_i and Island bib_i.

Cat Snuke is on Island 11 now, and wants to go to Island NN. However, it turned out that there is no boat service from Island 11 to Island NN, so he wants to know whether it is possible to go to Island NN by using two boat services.

Help him.

Constraints

  • 3N2003 \leq N \leq 200 000000
  • 1M2001 \leq M \leq 200 000000
  • 1ai<biN1 \leq a_i < b_i \leq N
  • (ai,bi)(1,N)(a_i, b_i) \neq (1, N)
  • If iji \neq j, (ai,bi)(aj,bj)(a_i, b_i) \neq (a_j, b_j).

Input

Input is given from Standard Input in the following format:

NN MM

a1a_1 b1b_1

a2a_2 b2b_2

:

aMa_M bMb_M

Output

If it is possible to go to Island NN by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.

3 2
1 2
2 3
POSSIBLE
4 3
1 2
2 3
3 4
IMPOSSIBLE

You have to use three boat services to get to Island 44.

100000 1
1 99999
IMPOSSIBLE
5 5
1 3
4 5
2 3
2 4
1 4
POSSIBLE

You can get to Island 55 by using two boat services: Island 11 -> Island 44 -> Island 55.