package main import ( "fmt" "bufio" "os" ) type Array3D struct { array [] int xsize, ysize, zsize int } func (this *Array3D) new(xsize int, ysize int, zsize int) { this.array = make([]int, xsize * ysize * zsize) this.xsize = xsize this.ysize = ysize this.zsize = zsize } func (this *Array3D) set(x int, y int, z int, val int) { this.array[x * (this.ysize * this.zsize) + y * (this.zsize) + z] = val } func (this *Array3D) get(x int, y int, z int) int { 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 int fmt.Fscan(r, &N, &M) dp := new(Array3D) dp.new(N+1, N+1, N*N+1) dp.set(0, 0, 0, 1) 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)) } }