n, m, time = map(int, input().split()) dp = [[0 for _ in range(n)] for _ in range(time+1)] # dp[時間][都市] root = [] for i in range(m): root.append(tuple(map(int, input().split()))) dp[0][0] = 1 for i in range(time): for s,t in root: dp[i+1][s] += dp[i][t] dp[i+1][s] %= 998244353 dp[i+1][t] += dp[i][s] dp[i+1][t] %= 998244353 print(dp[time][0])