import sys input = sys.stdin.readline def iinput(): return int(input()) def sinput(): return input().rstrip() def i0input(): return int(input()) - 1 def linput(): return list(input().split()) def liinput(): return list(map(int, input().split())) def miinput(): return map(int, input().split()) def li0input(): return list(map(lambda x: int(x) - 1, input().split())) def mi0input(): return map(lambda x: int(x) - 1, input().split()) INF = 10**20 MOD = 998244353 def mat_mul(a, b) : I, J, K = len(a), len(b[0]), len(b) c = [[0] * J for _ in range(I)] for i in range(I) : for j in range(J) : for k in range(K) : c[i][j] += a[i][k] * b[k][j] c[i][j] %= MOD return c def mat_pow(x, n): y = [[0] * len(x) for _ in range(len(x))] for i in range(len(x)): y[i][i] = 1 while n > 0: if n & 1: y = mat_mul(x, y) x = mat_mul(x, x) n >>= 1 return y N, M, T = liinput() g = [[0 for _ in range(N)] for _ in range(N)] for _ in [0] * M: s, t = liinput() g[s][t] = 1 g[t][s] = 1 ans = mat_pow(g, T) print(ans[0][0])