from collections import defaultdict

from itertools import permutations





def main():

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

    graph = defaultdict(list)

    for _ in range(M):

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

        graph[a].append(b)

        graph[b].append(a)



    ans = 0

    for route in permutations(list(range(2, N + 1)), N - 1):

        ok = True

        now = 1

        for node in route:

            if node in graph[now]:

                now = node

            else:

                ok = False

        ans += ok



    print(ans)





if __name__ == '__main__':

    main()

from collections import defaultdict

from itertools import permutations





def main():

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

    s = set()

    for _ in range(M):

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

        s.add((a, b))

        s.add((b, a))

    ans = 0

    for x in permutations(list(range(2, N + 1))):

        now = 1

        for i in range(len(x)):

            if (now, x[i]) not in s:

                break

            now = x[i]

        else:

            ans += 1

    print(ans)



if __name__ == '__main__':

    main()

from collections import defaultdict
from itertools import permutations


def main():
    N, M = list(map(int, input().split()))
    graph = defaultdict(list)
    for _ in range(M):
        a, b = list(map(int, input().split()))
        graph[a].append(b)
        graph[b].append(a)
    ans = 0
    for route in permutations(list(range(2, N + 1)), N - 1):
        ok = True
        now = 1
        for node in route:
            if node in graph[now]:
                now = node
            else:
                ok = False
        ans += ok
    print(ans)


if __name__ == "__main__":
    main()

from collections import defaultdict
from itertools import permutations


def main():
    N, M = list(map(int, input().split()))
    s = set()
    for _ in range(M):
        a, b = list(map(int, input().split()))
        s.add((a, b))
        s.add((b, a))
    ans = 0
    for x in permutations(list(range(2, N + 1))):
        now = 1
        for i in range(len(x)):
            if (now, x[i]) not in s:
                break
            now = x[i]
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

-    graph = defaultdict(list) +    s = set() -        graph[a].append(b) -        graph[b].append(a) +        s.add((a, b)) +        s.add((b, a)) -    for route in permutations(list(range(2, N + 1)), N - 1): -        ok = True +    for x in permutations(list(range(2, N + 1))): -        for node in route: -            if node in graph[now]: -                now = node -            else: -                ok = False -        ans += ok +        for i in range(len(x)): +            if (now, x[i]) not in s: +                break +            now = x[i] +        else: +            ans += 1