#include namespace { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic pop using namespace std; using namespace atcoder; #define rep(i,n)for (int i = 0; i < int(n); ++i) #define rrep(i,n)for (int i = int(n)-1; i >= 0; --i) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() template void chmax(T& a, const T& b) { a = max(a, b); } template void chmin(T& a, const T& b) { a = min(a, b); } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; using mint = modint998244353; template struct Mat: std::vector> { Mat(int n=0): std::vector>::vector(n, vector(n, zero())) {} friend Mat operator*(const Mat& lhs, const Mat& rhs) { assert(lhs.size() == rhs.size()); const int n = lhs.size(); Mat ret(n); for(int i = 0; i < n; i++) for(int k = 0; k < n; k++) for(int j = 0; j < n; j++) { ret[i][j] += lhs[i][k] * rhs[k][j]; } return ret; } Mat& operator*=(const Mat& rhs) { return (*this) = (*this) * rhs; } friend Mat operator+(const Mat& lhs, const Mat& rhs) { assert(lhs.size() == rhs.size()); const int n = lhs.size(); Mat ret(n); for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) ret[i][j] = lhs[i][j] + rhs[i][j]; return ret; } Mat& operator+=(const Mat& rhs) { return (*this) = (*this) + rhs; } Mat pow(unsigned long long n) { Mat A = *this; Mat res = Mat::I(A.size()); for(; n; n >>= 1) { if (n & 1) res *= A; A *= A; } return res; } static Mat I(int n) { Mat ret(n); for(int i = 0; i < n; i++) ret[i][i] = one(); return ret; } }; mint zero() { return mint(); } mint one() { return mint::raw(1); } } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; ll t; cin >> n >> m >> t; Mat a(n); rep(_, m) { int s, t; cin >> s >> t; a[s][t] = a[t][s] = 1; } cout << a.pow(t)[0][0].val() << '\n'; }