Problem:
Score : 300 points

Problem Statement

In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.
For convenience, we will call them Island 1, Island 2, ..., Island N.

There are M kinds of regular boat services between these islands.
Each service connects two islands. The i-th service connects Island a_i and Island b_i.

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

Help him.

Constraints

3 ≤ N ≤ 200 000

1 ≤ M ≤ 200 000

1 ≤ a_i < b_i ≤ N

(a_i, b_i) \neq (1, N)

If i \neq j, (a_i, b_i) \neq (a_j, b_j).

Input

Input is given from Standard Input in the following format:

N M
a_1 b_1
a_2 b_2
:
a_M b_M

Output

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

Sample Input 1

3 2
1 2
2 3

Sample Output 1

POSSIBLE

Sample Input 2

4 3
1 2
2 3
3 4

Sample Output 2

IMPOSSIBLE

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

Sample Input 3

100000 1
1 99999

Sample Output 3

IMPOSSIBLE

Sample Input 4

5 5
1 3
4 5
2 3
2 4
1 4

Sample Output 4

POSSIBLE

You can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.

Solution in Rust (1.15.1) (judge verdict: Time Limit Exceeded)

/// ========== 入力用マクロ ====================================================
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
/// FromStr型, Vec<T: FromStr>, Vec<char>, に対応;
/// 
/// 入力と平行して処理したいときには使えない -> 後述の read() を使用
#[macro_export]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[macro_export]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[macro_export]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


// ========== 常用関数 =======================================================


// 10^9 + 7 で割ったあまりを出力してください
pub const MOD: u64 = 1_000_000_007;

// atcoder文字列, 使うときは`main()`内にコピペ
// let atcoder: Vec<char> = vec!['a', 't', 'c', 'o', 'd', 'e', 'r'];

/// 標準入力から
/// 空白文字で囲まれた1つのトークンを
/// 指定の型に変換する
pub fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

/// 標準入力から1行読み取り
/// 空白文字で区切って
/// 指定の型の`Vec`に格納する
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

/// ユークリッドの互除法より
/// 2数の最大公約数を求める
pub fn gcd(arg1: usize, arg2: usize) -> usize {
    let mut u = if arg1 > arg2 { arg1 } else { arg2 };
    let mut v = if arg1 > arg2 { arg2 } else { arg1 };
    let mut r: usize;
    while v != 0 {
        r = u % v;
        u = v;
        v = r;
    }
    u
}

/// `Vec<usize>` に対して順に `gcd()` を適用して
/// 配列全体の最大公約数を求める
pub fn gcd_vec(v: &[usize]) -> usize {
    let mut r = v[0];
    for i in &v[1..] {
        r = gcd(r, *i);
    }
    r
}

/// `gcd()` を利用して2数の最小公倍数を求める
pub fn lcm(arg1: usize, arg2: usize) -> usize {
    arg1 * arg2 / gcd(arg1, arg2)
}

/// `Vec<usize>` に対して順に`lcm()` を適用して
/// 配列全体の最小公倍数を求める
pub fn lcm_vec(v: &[usize]) -> usize {
    let mut r = v[0];
    for i in &v[1..] {
        r = lcm(r, *i);
    }
    r
}

/// 与えられた `char` が母音であれば `true` を返す
pub fn is_vowel(c: char) -> bool {
    match c {
        'a' | 'i' | 'u' | 'e' | 'o' => true,
        _                           => false,
    }
}

/// プログラムを終了
pub fn exit() {
    std::process::exit(0)
}


// Rustの言語アップデートありがたいです
// 頑張ってください！


// ========== main() ==========================================================

fn main() {
    input!{
        n: usize, m: usize,
        ship: [(usize, usize); m],
    }

    let mut d = Vec::new();
    for &(a, b) in &ship {
        if a == 1 {
            d.push(b);
        }
    }

    for i in &d {
        for &(a, b) in &ship {
            if *i == a && b == n {
                println!("POSSIBLE");
                exit();
            }
        }
    }
    println!("IMPOSSIBLE");
}

// ========== 以下使い捨て関数 ===================================================