#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ int N,M,K; cin>>N>>M>>K; int t = 1; K++; rep(i,N)t *= K; vector> E(N); rep(i,M){ int u,v; cin>>u>>v; u--,v--; E[u].push_back(v); E[v].push_back(u); } vector dp(N,vector(t,0)); t = 1; rep(i,N){ dp[i][t] = 1; t *= K; } vector x(N); x[0] = 1; rep(i,N-1)x[i+1] = x[i] * K; rep(j,t){ rep(i,N){ rep(k,E[i].size()){ int to = E[i][k]; int jj = j; jj /= x[to]; if(jj%K==K-1)continue; jj = j; jj += x[to]; dp[to][jj] +=dp[i][j]; } } } mint ans = 0; rep(i,N)ans += dp[i].back(); cout<