import itertools



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

ab = []

for _ in range(M):

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

    ab.append({a-1, b-1})



ans = 0

for v in itertools.permutations(list(range(1, N))):

    ok = True

    a = 0

    for b in v:

        if {a, b} not in ab:

            ok = False

            break

        a = b

    if ok:

        ans += 1



print(ans)

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

ab = [[] for _ in range(N)]

for _ in range(M):

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

    ab[a-1].append(b-1)

    ab[b-1].append(a-1)



ans = 0

def dfs(x, visited):

    global ans

    if len(visited) == N:

        ans += 1

        return



    for b in ab[x]:

        if b not in visited:

            dfs(b, visited + [b])

    return



dfs(0, [0])

print(ans)

import itertools

N, M = list(map(int, input().split()))
ab = []
for _ in range(M):
    a, b = list(map(int, input().split()))
    ab.append({a - 1, b - 1})
ans = 0
for v in itertools.permutations(list(range(1, N))):
    ok = True
    a = 0
    for b in v:
        if {a, b} not in ab:
            ok = False
            break
        a = b
    if ok:
        ans += 1
print(ans)

N, M = list(map(int, input().split()))
ab = [[] for _ in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    ab[a - 1].append(b - 1)
    ab[b - 1].append(a - 1)
ans = 0


def dfs(x, visited):
    global ans
    if len(visited) == N:
        ans += 1
        return
    for b in ab[x]:
        if b not in visited:
            dfs(b, visited + [b])
    return


dfs(0, [0])
print(ans)

-import itertools - -ab = [] +ab = [[] for _ in range(N)] -    ab.append({a - 1, b - 1}) +    ab[a - 1].append(b - 1) +    ab[b - 1].append(a - 1) -for v in itertools.permutations(list(range(1, N))): -    ok = True -    a = 0 -    for b in v: -        if {a, b} not in ab: -            ok = False -            break -        a = b -    if ok: + + +def dfs(x, visited): +    global ans +    if len(visited) == N: +        return +    for b in ab[x]: +        if b not in visited: +            dfs(b, visited + [b]) +    return + + +dfs(0, [0])