import sys

sys.setrecursionlimit(6000)



n_node, n_path = [int(x) for x in input().split()]



A = [[0]*2 for x in range(n_path)]



for i in range(n_path):

	A[i][0], A[i][1] = [int(x) for x in input().split()]







def serch(A, cur_node, old, n_node):

	

	ans = 0

		

	if len(old) == (n_node-1):

		return 1

	

	for i in range(len(A)):

		

		if cur_node == A[i][0] and not(A[i][1] in old):

			A_copy = A.copy()

			A_copy.pop(i)

			old_copy = old.copy()

			old_copy.append(cur_node)

			ans += serch(A_copy, A[i][1], old_copy, n_node)

		

		elif cur_node == A[i][1] and not(A[i][0] in old):

			A_copy = A.copy()

			A_copy.pop(i)

			old_copy = old.copy()

			old_copy.append(cur_node)

			ans += serch(A_copy, A[i][0], old_copy, n_node)

	return ans



print((serch(A, 1, [], n_node)))



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



his=[False]*N



A=[[0]*2 for i in range(M)]

for i in range(M):

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

    A[i][0],A[i][1] =a-1,b-1



def search(now,his,A):

    

    if all(his):

        return 1

    

    else:

        cnt=0

        for a in A:

            if now in a:

                nex=a[(a.index(now)+1)%2]

                if not his[nex]:

                    his[nex]=True

                    cnt+=search(nex,his,A)

                    his[nex]=False

       

        return cnt



his[0]=True

print((search(0,his,A)))
import sys

sys.setrecursionlimit(6000)
n_node, n_path = [int(x) for x in input().split()]
A = [[0] * 2 for x in range(n_path)]
for i in range(n_path):
    A[i][0], A[i][1] = [int(x) for x in input().split()]


def serch(A, cur_node, old, n_node):
    ans = 0
    if len(old) == (n_node - 1):
        return 1
    for i in range(len(A)):
        if cur_node == A[i][0] and not (A[i][1] in old):
            A_copy = A.copy()
            A_copy.pop(i)
            old_copy = old.copy()
            old_copy.append(cur_node)
            ans += serch(A_copy, A[i][1], old_copy, n_node)
        elif cur_node == A[i][1] and not (A[i][0] in old):
            A_copy = A.copy()
            A_copy.pop(i)
            old_copy = old.copy()
            old_copy.append(cur_node)
            ans += serch(A_copy, A[i][0], old_copy, n_node)
    return ans


print((serch(A, 1, [], n_node)))

N, M = list(map(int, input().split()))
his = [False] * N
A = [[0] * 2 for i in range(M)]
for i in range(M):
    a, b = list(map(int, input().split()))
    A[i][0], A[i][1] = a - 1, b - 1


def search(now, his, A):
    if all(his):
        return 1
    else:
        cnt = 0
        for a in A:
            if now in a:
                nex = a[(a.index(now) + 1) % 2]
                if not his[nex]:
                    his[nex] = True
                    cnt += search(nex, his, A)
                    his[nex] = False
        return cnt


his[0] = True
print((search(0, his, A)))

-import sys - -sys.setrecursionlimit(6000) -n_node, n_path = [int(x) for x in input().split()] -A = [[0] * 2 for x in range(n_path)] -for i in range(n_path): -    A[i][0], A[i][1] = [int(x) for x in input().split()] +N, M = list(map(int, input().split())) +his = [False] * N +A = [[0] * 2 for i in range(M)] +for i in range(M): +    a, b = list(map(int, input().split())) +    A[i][0], A[i][1] = a - 1, b - 1 -def serch(A, cur_node, old, n_node): -    ans = 0 -    if len(old) == (n_node - 1): +def search(now, his, A): +    if all(his): -    for i in range(len(A)): -        if cur_node == A[i][0] and not (A[i][1] in old): -            A_copy = A.copy() -            A_copy.pop(i) -            old_copy = old.copy() -            old_copy.append(cur_node) -            ans += serch(A_copy, A[i][1], old_copy, n_node) -        elif cur_node == A[i][1] and not (A[i][0] in old): -            A_copy = A.copy() -            A_copy.pop(i) -            old_copy = old.copy() -            old_copy.append(cur_node) -            ans += serch(A_copy, A[i][0], old_copy, n_node) -    return ans +    else: +        cnt = 0 +        for a in A: +            if now in a: +                nex = a[(a.index(now) + 1) % 2] +                if not his[nex]: +                    his[nex] = True +                    cnt += search(nex, his, A) +                    his[nex] = False +        return cnt -print((serch(A, 1, [], n_node))) +his[0] = True +print((search(0, his, A)))