package main import ( "fmt" "bufio" "os" ) type Array3D struct { array [] int32 xsize, ysize, zsize int32 } func (this *Array3D) new(xsize int32, ysize int32, zsize int32) { this.array = make([]int32, xsize * ysize * zsize) this.xsize = xsize this.ysize = ysize this.zsize = zsize } func (this *Array3D) set(x int32, y int32, z int32, val int32) { this.array[x * (this.ysize * this.zsize) + y * (this.zsize) + z] = val } func (this *Array3D) get(x int32, y int32, z int32) int32 { return this.array[x * (this.ysize * this.zsize) + y * (this.zsize) + z] } func main() { r := bufio.NewReader(os.Stdin) w := bufio.NewWriter(os.Stdout) defer w.Flush() var N, M int32 fmt.Fscan(r, &N, &M) dp := new(Array3D) dp.new(N+1, N+1, N*N+1) dp.set(0, 0, 0, 1) var i, j, k int32 for i = 0; i <= N; i++ { for j = 0; j <= N; j++ { for k = 0; k <= N*N; k++ { if k+j <= N*N && i+1 <= N { dp.set(i+1, j, k+j, (dp.get(i+1, j, k+j) + dp.get(i, j, k)) % M) } if i >= j+1 && j+1 <= N { dp.set(i, j+1, k, (dp.get(i, j+1, k) + dp.get(i, j, k)) % M) } } } } for i = 0; i <= N*N; i++ { fmt.Fprintln(w, dp.get(N, N, i)) } }