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

G = {}

for _ in range(M):

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

    if a not in G:

        G[a] = []

    G[a].append(b)

    if b not in G:

        G[b] = []

    G[b].append(a)

hist = [0 for _ in range(N+1)]

stack = [1]

hist[1] = 1

cnt = 0

F = {}

while stack:

    cur = stack[-1]

    if cur not in F:

        F[cur] = G[cur][:]

        F[cur] = iter(F[cur])

    F1 = list(F[cur])

#     print("cur={},F1={}".format(cur,F1))

    if len(F1)>0:

        F[cur] = iter(F1)

        x = next(F[cur])

        if hist[x]==0:

            stack.append(x)

            hist[x] = 1

        else:

            if sum(hist)==N:

                cnt += 1

                hist[cur]=0

                del F[cur]

                stack.pop()

    else:

#         print("cur={}".format(cur))

#         print("stack={}".format(stack))

        if sum(hist)==N:

            cnt += 1

        hist[cur]=0

        del F[cur]

        stack.pop()

print(cnt)
from itertools import permutations

def check(i,j):

    if j==N-2 and x[j] in G[i]:

        return True

    if x[j] in G[i]:

        return check(x[j],j+1)

    return False

    

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

G = {i:[] for i in range(1,N+1)}

for _ in range(M):

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

    G[a].append(b)

    G[b].append(a)

cnt = 0

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

    if check(1,0):

        cnt += 1

print(cnt)   
N, M = list(map(int, input().split()))
G = {}
for _ in range(M):
    a, b = list(map(int, input().split()))
    if a not in G:
        G[a] = []
    G[a].append(b)
    if b not in G:
        G[b] = []
    G[b].append(a)
hist = [0 for _ in range(N + 1)]
stack = [1]
hist[1] = 1
cnt = 0
F = {}
while stack:
    cur = stack[-1]
    if cur not in F:
        F[cur] = G[cur][:]
        F[cur] = iter(F[cur])
    F1 = list(F[cur])
    #     print("cur={},F1={}".format(cur,F1))
    if len(F1) > 0:
        F[cur] = iter(F1)
        x = next(F[cur])
        if hist[x] == 0:
            stack.append(x)
            hist[x] = 1
        else:
            if sum(hist) == N:
                cnt += 1
                hist[cur] = 0
                del F[cur]
                stack.pop()
    else:
        #         print("cur={}".format(cur))
        #         print("stack={}".format(stack))
        if sum(hist) == N:
            cnt += 1
        hist[cur] = 0
        del F[cur]
        stack.pop()
print(cnt)

from itertools import permutations


def check(i, j):
    if j == N - 2 and x[j] in G[i]:
        return True
    if x[j] in G[i]:
        return check(x[j], j + 1)
    return False


N, M = list(map(int, input().split()))
G = {i: [] for i in range(1, N + 1)}
for _ in range(M):
    a, b = list(map(int, input().split()))
    G[a].append(b)
    G[b].append(a)
cnt = 0
for x in permutations(list(range(2, N + 1)), N - 1):
    if check(1, 0):
        cnt += 1
print(cnt)

+from itertools import permutations + + +def check(i, j): +    if j == N - 2 and x[j] in G[i]: +        return True +    if x[j] in G[i]: +        return check(x[j], j + 1) +    return False + + -G = {} +G = {i: [] for i in range(1, N + 1)} -    if a not in G: -        G[a] = [] -    if b not in G: -        G[b] = [] -hist = [0 for _ in range(N + 1)] -stack = [1] -hist[1] = 1 -F = {} -while stack: -    cur = stack[-1] -    if cur not in F: -        F[cur] = G[cur][:] -        F[cur] = iter(F[cur]) -    F1 = list(F[cur]) -    #     print("cur={},F1={}".format(cur,F1)) -    if len(F1) > 0: -        F[cur] = iter(F1) -        x = next(F[cur]) -        if hist[x] == 0: -            stack.append(x) -            hist[x] = 1 -        else: -            if sum(hist) == N: -                cnt += 1 -                hist[cur] = 0 -                del F[cur] -                stack.pop() -    else: -        #         print("cur={}".format(cur)) -        #         print("stack={}".format(stack)) -        if sum(hist) == N: -            cnt += 1 -        hist[cur] = 0 -        del F[cur] -        stack.pop() +for x in permutations(list(range(2, N + 1)), N - 1): +    if check(1, 0): +        cnt += 1