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

g = [[False]*N for _ in range(N)]

for _ in range(M):

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

	g[a-1][b-1] = True

	g[b-1][a-1] = True



stack = [[0,[1]+[0]*(N-1)]]

ans = 0

while stack:

	cur, passed = stack.pop()

	if passed == [1]*N:

		ans += 1

	else:

		for i, j in enumerate(g[cur]):

			if j and not passed[i]:

				t = passed.copy()

				t[i] = 1

				stack.append([i, t])

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

g = [[] for i 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)



ans = 0

passed = [0]

n = 0

s = [[n,passed]]

while s:

	n, passed = s.pop()

	if len(passed) == N:

		ans += 1

	else:

		for i in g[n]:

			if i not in passed:

				s.append([i, passed + [i]])

print(ans)
N, M = list(map(int, input().split()))
g = [[False] * N for _ in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    g[a - 1][b - 1] = True
    g[b - 1][a - 1] = True
stack = [[0, [1] + [0] * (N - 1)]]
ans = 0
while stack:
    cur, passed = stack.pop()
    if passed == [1] * N:
        ans += 1
    else:
        for i, j in enumerate(g[cur]):
            if j and not passed[i]:
                t = passed.copy()
                t[i] = 1
                stack.append([i, t])
print(ans)

N, M = list(map(int, input().split()))
g = [[] for i 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)
ans = 0
passed = [0]
n = 0
s = [[n, passed]]
while s:
    n, passed = s.pop()
    if len(passed) == N:
        ans += 1
    else:
        for i in g[n]:
            if i not in passed:
                s.append([i, passed + [i]])
print(ans)

-g = [[False] * N for _ in range(N)] -for _ in range(M): +g = [[] for i in range(N)] +for i in range(M): -    g[a - 1][b - 1] = True -    g[b - 1][a - 1] = True -stack = [[0, [1] + [0] * (N - 1)]] +    g[a - 1].append(b - 1) +    g[b - 1].append(a - 1) -while stack: -    cur, passed = stack.pop() -    if passed == [1] * N: +passed = [0] +n = 0 +s = [[n, passed]] +while s: +    n, passed = s.pop() +    if len(passed) == N: -        for i, j in enumerate(g[cur]): -            if j and not passed[i]: -                t = passed.copy() -                t[i] = 1 -                stack.append([i, t]) +        for i in g[n]: +            if i not in passed: +                s.append([i, passed + [i]])