from collections import defaultdict

from itertools import permutations

N, M = list(map(int, input().split()))

dic = defaultdict(list)

for i in range(M):

  a, b = list(map(int, input().split()))

  dic[a-1] += [b-1]

  dic[b-1] += [a-1]



ans = 0

ls = permutations(list(range(1,N)))

for l in ls:

  l = [0]+list(l)

  for i in range(N-1):

    if not l[i+1] in dic[l[i]]:

      break

    if i==N-2:

      ans += 1

print(ans)
from itertools import permutations

N, M, *L = list(map(int, open(0).read().split()))

dic = [[] for i in range(N+1)]

for a, b in zip(*[iter(L)]*2):

  dic[a].append(b)

  dic[b].append(a)



ans = 0

for l in permutations(list(range(2,N+1))):

  l = [1]+list(l)

  for i in range(N-1):

    if l[i+1] not in dic[l[i]]:

      break

  else:

    ans += 1

print(ans)
from collections import defaultdict
from itertools import permutations

N, M = list(map(int, input().split()))
dic = defaultdict(list)
for i in range(M):
    a, b = list(map(int, input().split()))
    dic[a - 1] += [b - 1]
    dic[b - 1] += [a - 1]
ans = 0
ls = permutations(list(range(1, N)))
for l in ls:
    l = [0] + list(l)
    for i in range(N - 1):
        if not l[i + 1] in dic[l[i]]:
            break
        if i == N - 2:
            ans += 1
print(ans)

from itertools import permutations

N, M, *L = list(map(int, open(0).read().split()))
dic = [[] for i in range(N + 1)]
for a, b in zip(*[iter(L)] * 2):
    dic[a].append(b)
    dic[b].append(a)
ans = 0
for l in permutations(list(range(2, N + 1))):
    l = [1] + list(l)
    for i in range(N - 1):
        if l[i + 1] not in dic[l[i]]:
            break
    else:
        ans += 1
print(ans)

-from collections import defaultdict -N, M = list(map(int, input().split())) -dic = defaultdict(list) -for i in range(M): -    a, b = list(map(int, input().split())) -    dic[a - 1] += [b - 1] -    dic[b - 1] += [a - 1] +N, M, *L = list(map(int, open(0).read().split())) +dic = [[] for i in range(N + 1)] +for a, b in zip(*[iter(L)] * 2): +    dic[a].append(b) +    dic[b].append(a) -ls = permutations(list(range(1, N))) -for l in ls: -    l = [0] + list(l) +for l in permutations(list(range(2, N + 1))): +    l = [1] + list(l) -        if not l[i + 1] in dic[l[i]]: +        if l[i + 1] not in dic[l[i]]: -        if i == N - 2: -            ans += 1 +    else: +        ans += 1