import Data.Bool
import qualified Data.ByteString.Char8 as C
import Data.List
import qualified Data.Set as S

main = C.interact $ put . sol . get

get = fmap (unfoldr (C.readInt . C.dropWhile (==' '))) . C.lines

put = C.pack . show

sol ([n,_]:es)= f 1 (S.fromList [2..n]) es

f _ vs [] = bool 0 1 $ S.null vs
f p vs es = sum [f c vs' es' | e <- cs, let c = g p e, let vs' = S.delete c vs]
  where
  (cs,es') = partition (\[u,v] -> u==p || v==p) es

g p [u,v]
  | u==p = v
  | v==p = u 