n, m = list(map(int, input().split()))

e = [set([]) for _ in range(n+1)] # e[0] never used

for _ in range(m):

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

    e[a].add(b)

    e[b].add(a)



ans = 0

visited = [False]*(n+1) # visited[0] never used

visited[0] = True

def dfs(v):

    # current pos is v

    global visited

    global ans

    if all(v==True for v in visited):

        ans += 1

        return

    

    for next_pos in e[v]:

        if visited[next_pos] != True:

            visited[next_pos] = True

            dfs(next_pos)

            visited[next_pos] = False



visited[1] = True

dfs(1)

print(ans)
from itertools import permutations



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

INF = 10**18

matrix = [[INF]*N for _ in range(N)]

for _ in range(M):

    a, b = [int(x)-1 for x in input().split()]

    matrix[a][b] = 1

    matrix[b][a] = 1



ans = 0





for p in permutations(list(range(1, N))):

    ok = True

    cur = 0

    for pi in p:

        if matrix[cur][pi] == INF:

            ok = False

            break

        cur = pi

    if ok:

        ans += 1



print(ans)

n, m = list(map(int, input().split()))
e = [set([]) for _ in range(n + 1)]  # e[0] never used
for _ in range(m):
    a, b = list(map(int, input().split()))
    e[a].add(b)
    e[b].add(a)
ans = 0
visited = [False] * (n + 1)  # visited[0] never used
visited[0] = True


def dfs(v):
    # current pos is v
    global visited
    global ans
    if all(v == True for v in visited):
        ans += 1
        return
    for next_pos in e[v]:
        if visited[next_pos] != True:
            visited[next_pos] = True
            dfs(next_pos)
            visited[next_pos] = False


visited[1] = True
dfs(1)
print(ans)

from itertools import permutations

N, M = list(map(int, input().split()))
INF = 10**18
matrix = [[INF] * N for _ in range(N)]
for _ in range(M):
    a, b = [int(x) - 1 for x in input().split()]
    matrix[a][b] = 1
    matrix[b][a] = 1
ans = 0
for p in permutations(list(range(1, N))):
    ok = True
    cur = 0
    for pi in p:
        if matrix[cur][pi] == INF:
            ok = False
            break
        cur = pi
    if ok:
        ans += 1
print(ans)

-n, m = list(map(int, input().split())) -e = [set([]) for _ in range(n + 1)]  # e[0] never used -for _ in range(m): -    a, b = list(map(int, input().split())) -    e[a].add(b) -    e[b].add(a) +from itertools import permutations + +N, M = list(map(int, input().split())) +INF = 10**18 +matrix = [[INF] * N for _ in range(N)] +for _ in range(M): +    a, b = [int(x) - 1 for x in input().split()] +    matrix[a][b] = 1 +    matrix[b][a] = 1 -visited = [False] * (n + 1)  # visited[0] never used -visited[0] = True - - -def dfs(v): -    # current pos is v -    global visited -    global ans -    if all(v == True for v in visited): +for p in permutations(list(range(1, N))): +    ok = True +    cur = 0 +    for pi in p: +        if matrix[cur][pi] == INF: +            ok = False +            break +        cur = pi +    if ok: -        return -    for next_pos in e[v]: -        if visited[next_pos] != True: -            visited[next_pos] = True -            dfs(next_pos) -            visited[next_pos] = False - - -visited[1] = True -dfs(1)