fun main(args: Array<String>) {
    val (n, m) = readInputLine().split(" ").map { it.toInt() }
    val ships = mutableMapOf<Int, MutableSet<Int>>()

    for (i in 1..m) {
        val (a, b) = readInputLine().split(" ").map { it.toInt() }
        val set = ships.get(a) ?: mutableSetOf<Int>()
        set.add(b)
        ships.put(a, set)
    }

    val firstSteps = ships.get(1)

    if (firstSteps == null) {
        println("IMPOSSIBLE")
        return
    }

    for (i in firstSteps) {
        val secondSteps = ships.get(i)
        if (secondSteps == null) {
            continue
        }
        if (secondSteps.contains(n)) {
            println("POSSIBLE")
            return
        }
    }
    println("IMPOSSIBLE")
}

fun readInputLine(): String {
    return readLine()!!
}
