use proconio::input; fn main() { input! { n:usize, m:usize, } let mut dp = vec![vec![0; n * n + 1]; n + 1]; dp[0][0] = 1; for i in 1..=n { for u in 0..=i - 1 { let v = i - 1 - u; for k in 0..=n * n { if k + u * v + v > n * n { break; } for l in 0..=n * n { if k + l + u * v + v <= n * n { dp[i][k + l + u * v + v] = dp[i][k + l + u * v + v] + dp[u][k] * dp[v][l]; dp[i][k + l + u * v + v] %= m; } else { break; } } } } } for i in 0..=n * n { println!("{}", dp[n][i]); } }