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..=u * u { for l in 0..=v * v { dp[i][k + l + u * v + v] = dp[i][k + l + u * v + v] + dp[u][k] * dp[v][l] % m; dp[i][k + l + u * v + v] %= m; } } } } for i in 0..=n * n { println!("{}", dp[n][i]); } // for i in 0..=n{ // for j in 0..=n*n{ // print!("{} ",dp[i][j]); // } // println!(); // } }