#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef vector vec; typedef vector mat; ll N, M, T; ll MOD = 998'244'353; mat mul(mat &A, mat &B) { mat C(A.size(), vec(B[0].size())); for (int i = 0; i < A.size(); ++i) { for (int k = 0; k < B.size(); ++k) { for (int j = 0; j < B[0].size(); ++j) { C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD; } } } return C; } // 行列の累乗 mat pow(mat A, ll n) { mat B(A.size(), vec(A.size())); for (int i = 0; i < A.size(); ++i) { B[i][i] = 1; } while (n > 0) { if (n & 1) B = mul(B, A); A = mul(A, A); n >>= 1; } return B; } int main() { cin >> N >> M >> T; mat m(N); for (int i = 0; i < N; ++i) { m[i] = vector(N, 0); } for (int i = 0; i < M; ++i) { int s, t; cin >> s >> t; m[s][t] = m[t][s] = 1; } mat C = pow(m, T); if (T == 0) { cout << 1 << endl; } else { cout << C[0][0] % MOD << endl; } return 0; }