from itertools import permutations as per

ty,he=list(map(int,input().split()))

l=[set(map(int,input().split())) for i in range(he)]

ans=0

for g in per(list(range(2,ty+1))):

  co=[1]+list(g)

  for sd in zip(co,co[1:]):

    if set(sd) not in l:break

  else:ans+=1

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

e=[[0 for _ in range(n)] for i in range(n)]

for i in range(m):

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

    e[a-1][s-1]=1;e[s-1][a-1]=1

ans=0

from itertools import permutations as pe

for i in pe(list(range(1,n)),r=None):

    #rは長さ、Noneでiteraterの長さ

    pre=0

    for a in i:

        if e[pre][a]!=1:break

        pre=a

    else:ans+=1

print(ans)
from itertools import permutations as per

ty, he = list(map(int, input().split()))
l = [set(map(int, input().split())) for i in range(he)]
ans = 0
for g in per(list(range(2, ty + 1))):
    co = [1] + list(g)
    for sd in zip(co, co[1:]):
        if set(sd) not in l:
            break
    else:
        ans += 1
print(ans)

n, m = list(map(int, input().split()))
e = [[0 for _ in range(n)] for i in range(n)]
for i in range(m):
    a, s = list(map(int, input().split()))
    e[a - 1][s - 1] = 1
    e[s - 1][a - 1] = 1
ans = 0
from itertools import permutations as pe

for i in pe(list(range(1, n)), r=None):
    # rは長さ、Noneでiteraterの長さ
    pre = 0
    for a in i:
        if e[pre][a] != 1:
            break
        pre = a
    else:
        ans += 1
print(ans)

-from itertools import permutations as per +n, m = list(map(int, input().split())) +e = [[0 for _ in range(n)] for i in range(n)] +for i in range(m): +    a, s = list(map(int, input().split())) +    e[a - 1][s - 1] = 1 +    e[s - 1][a - 1] = 1 +ans = 0 +from itertools import permutations as pe -ty, he = list(map(int, input().split())) -l = [set(map(int, input().split())) for i in range(he)] -ans = 0 -for g in per(list(range(2, ty + 1))): -    co = [1] + list(g) -    for sd in zip(co, co[1:]): -        if set(sd) not in l: +for i in pe(list(range(1, n)), r=None): +    # rは長さ、Noneでiteraterの長さ +    pre = 0 +    for a in i: +        if e[pre][a] != 1: +        pre = a