#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef int64_t ll; typedef std::pair Pii; typedef std::pair Pll; typedef std::pair Pdd; #define rip(_i, _n, _s) for (int _i = (_s); _i < (int)(_n); _i++) #define all(_l) _l.begin(), _l.end() #define rall(_l) _l.rbegin(), _l.rend() #define MM << " " << template using MaxHeap = std::priority_queue<_T>; template using MinHeap = std::priority_queue<_T, std::vector<_T>, std::greater<_T>>; template inline bool chmax(_T &_l, const _T _b) { if (_l < _b) { _l = _b; return true; } return false; } template inline bool chmin(_T &_l, const _T _b) { if (_l > _b) { _l = _b; return true; } return false; } template void vdeb(const std::vector<_T> &bb) { for (unsigned int i = 0;i < bb.size();i++) { if (i == bb.size() - 1) std::cout << bb[i]; else std::cout << bb[i] << ' '; } std::cout << '\n'; } template void vdeb(const std::vector> &bb) { for (unsigned int i = 0;i < bb.size();i++) { // std::cout << i << ' '; vdeb(bb[i]); } std::cout << '\n'; } using namespace std; int main() { int n, m; cin >> n >> m; vector>> dp(n*2+1,vector>(n+1,vector(n*n+1))); dp[0][0][0] = 1; rip(i,n*2,0) { rip(j,min(i+1,n+1),0) { rip(k,n*n+1,0) { dp[i][j][k] %= m; if(0 < j) dp[i+1][j-1][k] += dp[i][j][k]; if(j+1 <= n && k + (i-j)/2 <= n*n) dp[i+1][j+1][k+(i-j)/2] += dp[i][j][k]; } } } rip(i,n*n+1,0) { cout << dp[n*2][0][i]%m << endl; } // vdeb(dp); }