z,m=list(map(int,input().split()));a=[[],[]];ans=0

for i in range(m):aa,bb=list(map(int,input().split()));a[0].append(aa);a[1].append(bb)

def d(n,nl,ml):

  if sorted(nl+[n])==[i+1for i in range(z)]:return 1

  if n in nl:return 0

  l=len(ml[0]);ans=0

  for i in range(l):

    c=[ml[0][:i]+ml[0][i+1:],ml[1][:i]+ml[1][i+1:]]

    if ml[0][i]==n:ans+=d(ml[1][i],nl+[n],c)

    if ml[1][i]==n:ans+=d(ml[0][i],nl+[n],c)

  return ans

for i in range(m):

  if a[0][i]==1:

    c=[a[0][:i]+a[0][i+1:],a[1][:i]+a[1][i+1:]]

    ans+=d(a[1][i],[1],c)

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

edge=[n*[0]for _ in range(n)]

for i in range(m):

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

	a-=1

	b-=1

	edge[a][b]=edge[b][a]=1

from itertools import permutations

ans=0

for i in permutations([j for j in range(1,n)],n-1):

	f=True

	t=[0]+list(i)

	for j in range(1,n):

		if edge[t[j-1]][t[j]]==0:f=False

	if f:ans+=1

print(ans)
z, m = list(map(int, input().split()))
a = [[], []]
ans = 0
for i in range(m):
    aa, bb = list(map(int, input().split()))
    a[0].append(aa)
    a[1].append(bb)


def d(n, nl, ml):
    if sorted(nl + [n]) == [i + 1 for i in range(z)]:
        return 1
    if n in nl:
        return 0
    l = len(ml[0])
    ans = 0
    for i in range(l):
        c = [ml[0][:i] + ml[0][i + 1 :], ml[1][:i] + ml[1][i + 1 :]]
        if ml[0][i] == n:
            ans += d(ml[1][i], nl + [n], c)
        if ml[1][i] == n:
            ans += d(ml[0][i], nl + [n], c)
    return ans


for i in range(m):
    if a[0][i] == 1:
        c = [a[0][:i] + a[0][i + 1 :], a[1][:i] + a[1][i + 1 :]]
        ans += d(a[1][i], [1], c)
print(ans)

n, m = list(map(int, input().split()))
edge = [n * [0] for _ in range(n)]
for i in range(m):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    edge[a][b] = edge[b][a] = 1
from itertools import permutations

ans = 0
for i in permutations([j for j in range(1, n)], n - 1):
    f = True
    t = [0] + list(i)
    for j in range(1, n):
        if edge[t[j - 1]][t[j]] == 0:
            f = False
    if f:
        ans += 1
print(ans)

-z, m = list(map(int, input().split())) -a = [[], []] +n, m = list(map(int, input().split())) +edge = [n * [0] for _ in range(n)] +for i in range(m): +    a, b = list(map(int, input().split())) +    a -= 1 +    b -= 1 +    edge[a][b] = edge[b][a] = 1 +from itertools import permutations + -for i in range(m): -    aa, bb = list(map(int, input().split())) -    a[0].append(aa) -    a[1].append(bb) - - -def d(n, nl, ml): -    if sorted(nl + [n]) == [i + 1 for i in range(z)]: -        return 1 -    if n in nl: -        return 0 -    l = len(ml[0]) -    ans = 0 -    for i in range(l): -        c = [ml[0][:i] + ml[0][i + 1 :], ml[1][:i] + ml[1][i + 1 :]] -        if ml[0][i] == n: -            ans += d(ml[1][i], nl + [n], c) -        if ml[1][i] == n: -            ans += d(ml[0][i], nl + [n], c) -    return ans - - -for i in range(m): -    if a[0][i] == 1: -        c = [a[0][:i] + a[0][i + 1 :], a[1][:i] + a[1][i + 1 :]] -        ans += d(a[1][i], [1], c) +for i in permutations([j for j in range(1, n)], n - 1): +    f = True +    t = [0] + list(i) +    for j in range(1, n): +        if edge[t[j - 1]][t[j]] == 0: +            f = False +    if f: +        ans += 1