import typing import sys from collections import defaultdict, deque import heapq input = lambda: sys.stdin.readline().strip() inf = 10**18 mod = 998244353 # import pypyjit # pypyjit.set_param('max_unroll_recursion=-1') # sys.setrecursionlimit(10**6) def solve(): N, M, K = map(int, input().split()) # [v, k0, k1,...kN-1] # 頂点数はN*(K+1)^N <= 6*9^6 < 6*10^9 # sum(k)について単調性あり # つまりbfsでOK adj = [[] for _ in range(N)] for _ in range(M): a, b = map(lambda x: int(x)-1, input().split()) adj[a].append(b) adj[b].append(a) powk = [1] for i in range(N): powk.append(powk[-1]*(K+1)%mod) def dec(k): l = [0 for _ in range(N)] i = 0 while k: l[i] = k%(K+1) k//=(K+1) i+=1 return l dp = [[0 for _ in range((K+1)**N)] for _ in range(N)] for i in range(N): dp[i][powk[i]] = 1 for k in range(powk[N]): ks = dec(k) for v in range(N): for v_to in adj[v]: if ks[v_to] < K: dp[v_to][k + powk[v_to]] += dp[v][k] dp[v_to][k + powk[v_to]]%=mod ans = 0 for i in range(N): ans += dp[i][-1] print(ans%mod) def main(): t = 1 for _ in range(t): solve() main()