#![allow(unused_imports)] //use itertools::{iproduct, Itertools}; use proconio::input; use proconio::marker::*; use std::collections::*; fn main() { input! { n:usize, m:usize, k:usize, uv:[(Usize1,Usize1);m], } let mut g = vec![vec![]; n]; for &(u, v) in uv.iter() { g[u].push(v); g[v].push(u); } let mut l = 0; for _ in 0..n { l = l * (k + 1) + k; } let mut dp = vec![vec![ModInt::::new(0); n]; l + 1]; for i in 0..n { dp[(k + 1).pow((n - i) as u32 - 1)][i] = ModInt::new(1); } for i in 0..l { let crr_cnts = base_n(i, k + 1, n); for crr in 0..n { for &nxt in g[crr].iter() { if crr_cnts[nxt] >= k { continue; } let mut nxt_cnts = 0; let mut tmp = vec![]; for j in 0..n { nxt_cnts = if j == nxt { tmp.push(crr_cnts[j] + 1); nxt_cnts * (k + 1) + crr_cnts[j] + 1 } else { tmp.push(crr_cnts[j]); nxt_cnts * (k + 1) + crr_cnts[j] }; } dp[nxt_cnts][nxt] = dp[nxt_cnts][nxt] + dp[i][crr]; } } } let mut ans = ModInt::new(0); for i in 0..n { ans += dp[l][i]; } println!("{}", ans); } const MOD: usize = 998244353; use modint::*; mod modint { use std::fmt; use std::ops; #[derive(Copy, Clone, PartialEq, Eq)] pub struct ModInt { pub val: usize, } impl ModInt { pub fn new(val: usize) -> Self { Self { val: val % MOD } } pub fn pow(mut self, mut e: usize) -> Self { let mut res = Self::new(1); while 0 < e { if e & 1 != 0 { res *= self; } self *= self; e >>= 1; } res } } impl From for ModInt { fn from(value: usize) -> Self { Self { val: value % MOD } } } impl fmt::Display for ModInt { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.val) } } impl fmt::Debug for ModInt { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.val) } } impl ops::Neg for ModInt { type Output = Self; fn neg(self) -> Self::Output { Self { val: (MOD - self.val) % MOD, } } } impl ops::Add for ModInt { type Output = Self; fn add(self, rhs: Self) -> Self::Output { Self { val: (self.val + rhs.val) % MOD, } } } impl ops::AddAssign for ModInt { fn add_assign(&mut self, rhs: Self) { *self = *self + rhs; } } impl ops::Mul for ModInt { type Output = Self; fn mul(self, rhs: Self) -> Self::Output { Self { val: self.val * rhs.val % MOD, } } } impl ops::MulAssign for ModInt { fn mul_assign(&mut self, rhs: Self) { *self = *self * rhs; } } impl ops::Sub for ModInt { type Output = Self; fn sub(mut self, rhs: Self) -> Self::Output { if self.val < rhs.val { self.val += MOD; } Self { val: (self.val - rhs.val) % MOD, } } } impl ops::SubAssign for ModInt { fn sub_assign(&mut self, rhs: Self) { if self.val < rhs.val { self.val += MOD; } *self = *self - rhs; } } impl ops::Div for ModInt { type Output = Self; fn div(self, rhs: Self) -> Self { assert!(rhs.val != 0); self * rhs.pow(MOD - 2) } } impl ops::DivAssign for ModInt { fn div_assign(&mut self, rhs: Self) { *self = *self / rhs } } } use math::*; mod math { #[allow(dead_code)] pub fn pow(mut n: usize, mut e: usize, m: usize) -> usize { let mut res = 1; while 0 < e { if e & 1 != 0 { res *= n; res %= m; } n *= n; n %= m; e >>= 1; } res } #[allow(dead_code)] pub fn gcd(a: usize, b: usize) -> usize { if b == 0 { a } else { gcd(b, a % b) } } #[allow(dead_code)] pub fn lcm(a: usize, b: usize) -> usize { a / gcd(a, b) * b } #[allow(dead_code)] pub fn prime_factor(mut n: usize) -> std::collections::HashMap { let mut pfacs = std::collections::HashMap::new(); for d in 2.. { if d * d > n { break; } while n % d == 0 { *pfacs.entry(d).or_insert(0) += 1; n /= d; } } if n != 1 { *pfacs.entry(n).or_insert(0) += 1; } pfacs } #[allow(dead_code)] pub fn divisors(n: usize) -> Vec { let mut divs = vec![]; for d in (1..).take_while(|&d| d * d <= n) { if n % d == 0 { divs.push(d); if n / d != d { divs.push(n / d); } } } divs } #[allow(dead_code)] pub fn eratosthenes_sieve(n: usize) -> Vec { let mut is_primes = vec![true; n + 1]; is_primes[0] = false; is_primes[1] = false; let mut primes = vec![]; for i in 2..=n { if !is_primes[i] { continue; } for j in (2 * i..=n).step_by(i) { is_primes[j] = false; } } for (val, is_prime) in is_primes.into_iter().enumerate() { if is_prime { primes.push(val); } } primes } #[allow(dead_code)] pub fn base_n(mut base10: usize, base: usize, len: usize) -> Vec { let mut base_n = vec![]; for _ in 0..len { base_n.push(base10 % base); base10 /= base; } base_n.reverse(); base_n } #[allow(dead_code)] pub fn div_floor(mut a: i64, mut b: i64) -> i64 { if b < 0 { a = -a; b = -b; } if a >= 0 { a / b } else { (a + 1) / b - 1 } } #[allow(dead_code)] pub fn div_ceil(mut a: i64, mut b: i64) -> i64 { if b < 0 { a = -a; b = -b; } if a > 0 { (a - 1) / b + 1 } else { a / b } } }