import copy



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

E = [list(map(int, input().split())) for _ in range(M)]







def dfs(flg, E, i):

	q = []

	for e in E:

		if e[0] == i:

			if flg[e[1]-1] == 0:

				q.append(e[1])

		if e[1] == i:

			if flg[e[0]-1] == 0:

				q.append(e[0])

	if len(q) == 0:

		if flg.count(0) == 0:

			return 1

		else:

			return 0



	ans = 0

	for n in q:

		temp = copy.deepcopy(flg)

		temp[n-1] = 1

		ans += dfs(temp, E, n)



	return ans



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

flg[0] = 1

print((dfs(flg, E, 1)))
N, M = list(map(int, input().split()))

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



for _ in range(M):

	ta, tb = list(map(int, input().split()))

	E[ta-1].append(tb-1)

	E[tb-1].append(ta-1)





def next_permutation(out, cnt, flg):

	if cnt == N:

		for i in range(N-1):

			if out[i+1] not in E[out[i]]:

				return 0

		return 1



	ans = 0



	for i in range(N):

		if flg[i] == 0:

			out.append(i)

			flg[i] = 1



			ans += next_permutation(out, cnt+1, flg)



			out.pop()

			flg[i] = 0



	return ans



perm = [0]

cnt = 1

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

flg[0] = 1



answer = next_permutation(perm, cnt, flg)



print(answer)
import copy

N, M = list(map(int, input().split()))
E = [list(map(int, input().split())) for _ in range(M)]


def dfs(flg, E, i):
    q = []
    for e in E:
        if e[0] == i:
            if flg[e[1] - 1] == 0:
                q.append(e[1])
        if e[1] == i:
            if flg[e[0] - 1] == 0:
                q.append(e[0])
    if len(q) == 0:
        if flg.count(0) == 0:
            return 1
        else:
            return 0
    ans = 0
    for n in q:
        temp = copy.deepcopy(flg)
        temp[n - 1] = 1
        ans += dfs(temp, E, n)
    return ans


flg = [0 for _ in range(N)]
flg[0] = 1
print((dfs(flg, E, 1)))

N, M = list(map(int, input().split()))
E = [[] for _ in range(N)]
for _ in range(M):
    ta, tb = list(map(int, input().split()))
    E[ta - 1].append(tb - 1)
    E[tb - 1].append(ta - 1)


def next_permutation(out, cnt, flg):
    if cnt == N:
        for i in range(N - 1):
            if out[i + 1] not in E[out[i]]:
                return 0
        return 1
    ans = 0
    for i in range(N):
        if flg[i] == 0:
            out.append(i)
            flg[i] = 1
            ans += next_permutation(out, cnt + 1, flg)
            out.pop()
            flg[i] = 0
    return ans


perm = [0]
cnt = 1
flg = [0 for _ in range(N)]
flg[0] = 1
answer = next_permutation(perm, cnt, flg)
print(answer)

-import copy - -E = [list(map(int, input().split())) for _ in range(M)] +E = [[] for _ in range(N)] +for _ in range(M): +    ta, tb = list(map(int, input().split())) +    E[ta - 1].append(tb - 1) +    E[tb - 1].append(ta - 1) -def dfs(flg, E, i): -    q = [] -    for e in E: -        if e[0] == i: -            if flg[e[1] - 1] == 0: -                q.append(e[1]) -        if e[1] == i: -            if flg[e[0] - 1] == 0: -                q.append(e[0]) -    if len(q) == 0: -        if flg.count(0) == 0: -            return 1 -        else: -            return 0 +def next_permutation(out, cnt, flg): +    if cnt == N: +        for i in range(N - 1): +            if out[i + 1] not in E[out[i]]: +                return 0 +        return 1 -    for n in q: -        temp = copy.deepcopy(flg) -        temp[n - 1] = 1 -        ans += dfs(temp, E, n) +    for i in range(N): +        if flg[i] == 0: +            out.append(i) +            flg[i] = 1 +            ans += next_permutation(out, cnt + 1, flg) +            out.pop() +            flg[i] = 0 +perm = [0] +cnt = 1 -print((dfs(flg, E, 1))) +answer = next_permutation(perm, cnt, flg) +print(answer)