import itertools



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

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

for i in range(M):

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

    a -= 1

    b -= 1

    E[a].append(b)

    E[b].append(a)



count = 0

for V in itertools.permutations(list(range(1, N))):

    if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in range(1, N-1)):

        count += 1

print(count)

from itertools import permutations



def int0(s):

    return int(s) - 1



def main():

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

    edges = [tuple(map(int0, input().split())) for _ in range(M)]



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

    for a, b in edges:

        to[a][b] = True

        to[b][a] = True

    

    ans = 0

    for p in permutations(list(range(1, N))):

        if to[0][p[0]] and all(to[p[i]][p[i+1]] for i in range(N-2)):

            ans += 1

    print(ans)



if __name__ == "__main__":

    main()
import itertools

N, M = list(map(int, input().split()))
E = [[] for i in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    E[a].append(b)
    E[b].append(a)
count = 0
for V in itertools.permutations(list(range(1, N))):
    if V[0] in E[0] and all(V[i] in E[V[i - 1]] for i in range(1, N - 1)):
        count += 1
print(count)

from itertools import permutations


def int0(s):
    return int(s) - 1


def main():
    N, M = list(map(int, input().split()))
    edges = [tuple(map(int0, input().split())) for _ in range(M)]
    to = [[False] * N for _ in range(N)]
    for a, b in edges:
        to[a][b] = True
        to[b][a] = True
    ans = 0
    for p in permutations(list(range(1, N))):
        if to[0][p[0]] and all(to[p[i]][p[i + 1]] for i in range(N - 2)):
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

-import itertools +from itertools import permutations -N, M = list(map(int, input().split())) -E = [[] for i in range(N)] -for i in range(M): -    a, b = list(map(int, input().split())) -    a -= 1 -    b -= 1 -    E[a].append(b) -    E[b].append(a) -count = 0 -for V in itertools.permutations(list(range(1, N))): -    if V[0] in E[0] and all(V[i] in E[V[i - 1]] for i in range(1, N - 1)): -        count += 1 -print(count) + +def int0(s): +    return int(s) - 1 + + +def main(): +    N, M = list(map(int, input().split())) +    edges = [tuple(map(int0, input().split())) for _ in range(M)] +    to = [[False] * N for _ in range(N)] +    for a, b in edges: +        to[a][b] = True +        to[b][a] = True +    ans = 0 +    for p in permutations(list(range(1, N))): +        if to[0][p[0]] and all(to[p[i]][p[i + 1]] for i in range(N - 2)): +            ans += 1 +    print(ans) + + +if __name__ == "__main__": +    main()