fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)
    // 辺
    val sides = Array(m) {
        readLine()!!.split(" ").map(String::toInt).let { it[0] to it[1] }
    }

    val vertexes = (1..n).toList()
    var count = 0

    fun dfs(index: Int, routes: IntArray) {
        if (index == n) {
            count++
            return
        }
        sides.filter { it.first == routes[index - 1] || it.second == routes[index - 1] }.forEach { side ->
            vertexes.filter { !routes.contains(it) }.filter { side.first == it || side.second == it }.forEach {
                val array = routes.copyOf()
                array[index] = it
                dfs(index + 1, array)
            }
        }
    }

    dfs(1, IntArray(n).apply { this[0] = 1 })
    println(count)
}