MOD = 998244353 n, m, T = map(int, input().split()) edges = [] for _ in range(m): s, t = map(int, input().split()) edges.append((s, t)) dp = [[0] * n for _ in range(T + 1)] dp[0][0] = 1 for i in range(1, T + 1): for s, t in edges: dp[i][s] += dp[i - 1][t] dp[i][t] += dp[i - 1][s] dp[i][s] %= MOD dp[i][t] %= MOD print(dp[-1][0])