#agc055f. [agc055_f]Creative Splitting

[agc055_f]Creative Splitting

Problem Statement

You are given integers NN and KK.

Let's call an integer array a=\[a_1, a_2, \\ldots, a_K\] of length KK good, if 1leailei1 \\le a_i \\le i for all 1leileK1 \\le i \\le K.

Let's call an integer array b=\[b_1, b_2, \\ldots, b_{NK}\] of length NKNK amazing, if it can be split into NN (not necessarily contiguous) subsequences of length KK, each of which is good.

Let's define f(pos,val)f(pos, val) as the number of amazing sequences bb such that bpos=valb_{pos}=val.

Find f(pos,val)f(pos, val) for all 1leposleNK1\\le pos \\le NK, 1levalleK1 \\le val \\le K. As these numbers can be very big, output them modulo some prime PP.

Constraints

  • 1leNle201 \\le N \\le 20.
  • 1leKle201 \\le K \\le 20.
  • 108lePle10910^8 \\le P \\le 10^9
  • PP is a prime.

Input

Input is given from Standard Input in the following format:

NN KK PP

Output

Output NKNK lines. The jj-th number in the ii-th line should be equal to (f(i,j)bmodP)(f(i, j) \\bmod P).


Sample Input 1

2 2 965166677

Sample Output 1

6 0 
4 2 
4 2 
3 3 

There exist 66 amazing arrays:

  • \[1, 1, 1, 1\] ー can be split into \[b_1, b_2\], \[b_3, b_4\].
  • \[1, 1, 1, 2\] ー can be split into \[b_1, b_2\], \[b_3, b_4\].
  • \[1, 2, 1, 1\] ー can be split into \[b_1, b_2\], \[b_3, b_4\].
  • \[1, 2, 1, 2\] ー can be split into \[b_1, b_2\], \[b_3, b_4\].
  • \[1, 1, 2, 1\] ー can be split into \[b_1, b_3\], \[b_2, b_4\].
  • \[1, 1, 2, 2\] ー can be split into \[b_1, b_3\], \[b_2, b_4\].