import itertools



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

edges = [tuple(sorted(map(int, input().split()))) for _ in range(M)]



answer = 0

for i in itertools.permutations(list(range(2, N+1)), N-1):

    l = [1] + list(i)

    answer += sum(1 for x in zip(l, l[1:]) if tuple(sorted(x)) in edges) == N-1

print(answer)    
from itertools import permutations



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

AB = set([tuple(sorted(map(int, input().split()))) for _ in range(M)])



answer = 0

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

    pattern = [1] + list(pattern)

    for i in zip(pattern[:-1], pattern[1:]):

        if tuple(sorted(i)) not in AB:

            break

    else:

        answer += 1

print(answer)
import itertools

N, M = list(map(int, input().split()))
edges = [tuple(sorted(map(int, input().split()))) for _ in range(M)]
answer = 0
for i in itertools.permutations(list(range(2, N + 1)), N - 1):
    l = [1] + list(i)
    answer += sum(1 for x in zip(l, l[1:]) if tuple(sorted(x)) in edges) == N - 1
print(answer)

from itertools import permutations

N, M = list(map(int, input().split()))
AB = set([tuple(sorted(map(int, input().split()))) for _ in range(M)])
answer = 0
for pattern in permutations(list(range(2, N + 1)), N - 1):
    pattern = [1] + list(pattern)
    for i in zip(pattern[:-1], pattern[1:]):
        if tuple(sorted(i)) not in AB:
            break
    else:
        answer += 1
print(answer)

-import itertools +from itertools import permutations -edges = [tuple(sorted(map(int, input().split()))) for _ in range(M)] +AB = set([tuple(sorted(map(int, input().split()))) for _ in range(M)]) -for i in itertools.permutations(list(range(2, N + 1)), N - 1): -    l = [1] + list(i) -    answer += sum(1 for x in zip(l, l[1:]) if tuple(sorted(x)) in edges) == N - 1 +for pattern in permutations(list(range(2, N + 1)), N - 1): +    pattern = [1] + list(pattern) +    for i in zip(pattern[:-1], pattern[1:]): +        if tuple(sorted(i)) not in AB: +            break +    else: +        answer += 1