N,M,K = map(int,input().split()) UV= [tuple(map(int,input().split())) for _ in range(M)] if N==1: exit(print(1 if K==1 else 0)) MOD = 998244353 es = [[] for _ in range(N)] for u,v in UV: u,v = u-1,v-1 es[u].append(v) es[v].append(u) L = (K+1)**N dp = [[0]*L for _ in range(N)] for i in range(N): dp[i][(K+1)**i] = 1 for v in range(L): cnt = [] _v = v for _ in range(N): _v,m = divmod(_v,K+1) cnt.append(m) for i in range(N): if dp[i][v] == 0: continue for j in es[i]: if cnt[j]==K: continue nv = v + (K+1)**j dp[j][nv] += dp[i][v] dp[j][nv] %= MOD ans = 0 for i in range(N): ans += dp[i][-1] ans %= MOD print(ans)