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

graph = [[-1 for i in range(N)] for i in range(N)]

for i in range(M):

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

    graph[a - 1][b - 1] = 1

    graph[b - 1][a - 1] = 1

    

def dfs(node, depth):

    global visited

    global ans

    if depth == N - 1:

        if sum(visited) == N:

            ans += 1

        return

    for i in range(1, N):

        if graph[node][i] == 1 and visited[i] == -1:

            visited[i] = 1

            dfs(i, depth + 1)

            visited[i] = -1

            

visited = [-1 for i in range(N)]

visited[0] = 1



ans = 0

dfs(0, 0)



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

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

for i in range(M):

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

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

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



def dfs(depth, node):

    global visited

    global ans

    visited[node] = 1

    if depth == N - 1:

        if sum(visited) == N:  ans += 1

        return

    for i in G[node]:

        if visited[i] == 0:

            dfs(depth + 1, i)

            visited[i] = 0

            

ans = 0

visited = [0 for _ in range(N)]

dfs(0, 0)

print(ans)
N, M = list(map(int, input().split()))
graph = [[-1 for i in range(N)] for i in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1


def dfs(node, depth):
    global visited
    global ans
    if depth == N - 1:
        if sum(visited) == N:
            ans += 1
        return
    for i in range(1, N):
        if graph[node][i] == 1 and visited[i] == -1:
            visited[i] = 1
            dfs(i, depth + 1)
            visited[i] = -1


visited = [-1 for i in range(N)]
visited[0] = 1
ans = 0
dfs(0, 0)
print(ans)

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


def dfs(depth, node):
    global visited
    global ans
    visited[node] = 1
    if depth == N - 1:
        if sum(visited) == N:
            ans += 1
        return
    for i in G[node]:
        if visited[i] == 0:
            dfs(depth + 1, i)
            visited[i] = 0


ans = 0
visited = [0 for _ in range(N)]
dfs(0, 0)
print(ans)

-graph = [[-1 for i in range(N)] for i in range(N)] +G = [[] for _ in range(N)] -    graph[a - 1][b - 1] = 1 -    graph[b - 1][a - 1] = 1 +    G[a - 1].append(b - 1) +    G[b - 1].append(a - 1) -def dfs(node, depth): +def dfs(depth, node): +    visited[node] = 1 -    for i in range(1, N): -        if graph[node][i] == 1 and visited[i] == -1: -            visited[i] = 1 -            dfs(i, depth + 1) -            visited[i] = -1 +    for i in G[node]: +        if visited[i] == 0: +            dfs(depth + 1, i) +            visited[i] = 0 -visited = [-1 for i in range(N)] -visited[0] = 1 +visited = [0 for _ in range(N)]