import sys input = sys.stdin.readline from heapq import heappop,heappush from collections import Counter mod=998244353 N,M,K=map(int,input().split()) E=[[] for i in range(N)] for i in range(M): u,v=map(int,input().split()) u-=1 v-=1 E[u].append(v) E[v].append(u) def enc(x): now=1 ANS=0 for i in range(1,len(x)): ANS+=now*x[i] now*=K+1 ANS+=now*x[0] return ANS def dec(x): X=[] for i in range(N): X.append(x%(K+1)) x//=K+1 X=[x]+X return X DP=[0]*(((K+1)**N)*N) Q=[] USE=[0]*(((K+1)**N)*N) for i in range(N): x=[i]+[0]*N x[i+1]+=1 DP[enc(x)]=1 Q.append((1,enc(x))) USE[enc(x)]=1 while Q: S,i=heappop(Q) X=dec(i) #print(X,DP[i]) kk=X[0] for to in E[kk]: if X[to+1]+1<=K: X[to+1]+=1 X[0]=to #print("!",X) DP[enc(X)]=(DP[enc(X)]+DP[i])%mod if USE[enc(X)]==0: heappush(Q,(S+1,enc(X))) USE[enc(X)]=1 X[to+1]-=1 ANS=0 for i in range(N): x=[i]+[K]*N ANS+=DP[enc(x)] print(ANS%mod)