#include #include using namespace std; using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; using mint = modint998244353; const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n) - 1; i >= 0; --i) #define rrep2(i,l,r)for(int i=(r) - 1;i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } #include template std::vector> matrixMul(const std::vector>&A, const std::vector>&B) { std::vector> C(A.size(), std::vector(B[0].size())); for (int i = 0; i < (int)A.size(); ++i) { for (int k = 0; k < (int)A[0].size(); ++k) { for (int j = 0; j < (int)B[0].size(); ++j) { C[i][j] += A[i][k] * B[k][j]; } } } return C; } template std::vector> matrixPow(long long n, std::vector> mat) { int size = (int)mat.size(); vector> mret(size, vector(size)); for (int i = 0; i < size; ++i) { mret[i][i] = 1; } while (n > 0) { if (1 & n) mret = matrixMul(mat, mret); mat = matrixMul(mat, mat); n >>= 1; } return mret; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, x; cin >> n >> m >> x; vectord(n); vector a(n, vector(n)); vector to(n, vector(n)); rep(i, m) { int u, v; cin >> u >> v; u--, v--; d[u]++; if (u != v)d[v]++; to[u][v]++; if (u != v)to[v][u]++; } vectorinv(m + 1); rep2(i, 1, m + 1)inv[i] = mint(i).inv(); vector mat(n * (n + 1), vector(n * (n + 1))); rep(i, n)rep(j, n) { if (0 == d[j])continue; int p = i * n + j; if (1 != d[j]) { rep(k, n) { // (i,j)->(j,k) int q = j * n + k; mint val = to[j][k]; if (i == k) val--; mat[q][p] += val * inv[d[j] - 1]; } } else { int q = n * n + j; mat[q][p] += 1; } } rep(i, n) { int p = n * n + i; if (0 == d[i]) { mat[p][p] = 1; continue; } rep(j, n) { // (*,i)->(i,j) int q = i * n + j; mint val = to[i][j]; mat[q][p] += val * inv[d[i]]; } } mat = matrixPow(x, mat); rep(i, n) { mint ans = 0; rep(j, n + 1) ans += mat[j * n + i][n * n]; cout << ans.val() << endl; } return 0; }