import Data.Array.IO
import Data.List
import Data.IORef
import Data.Array

all_ord::Int -> [[Int]]
all_ord n = map (1:) (permutations [2..n])

main::IO()
main= do
  nmc<-getLine
  let n:m:[]=map read (words nmc)::[Int]
  con<-newArray ((1,1),(n,n)) False
  ptr<-newIORef con
  create_edge ptr m
  st_ar<-freeze con
  print (solver st_ar n)


create_edge::IORef (IOArray (Int,Int) Bool) -> Int -> IO()
create_edge _ 0 = return ()
create_edge pt n = do
  abc<-getLine
  let a:b:[]=map read (words abc) ::[Int]
  ar<-readIORef pt
  writeArray ar (a,b) True
  writeArray ar (b,a) True
  create_edge  pt (n-1)

solver::(Array (Int,Int) Bool) -> Int -> Int
solver ar n = length (filter (check ar) (all_ord n))

check::(Array (Int,Int) Bool) -> [Int] -> Bool
check _  []       =True
check _  (_:[])   =True
check ar (a:b:xs) =(ar!(a,b))&& (check ar (b:xs))
