def convolution(a,b,length): c=[0]*length for i in range(len(a)): for j in range(len(b)): if i+j>=length: break c[i+j]+=a[i]*b[j] c[i+j]%=Mod #================================================== N,Mod=map(int,input().split()) X=[] for i in range(N+1): if i==0: X.append(0) elif i==1: X.append(1) else: X.append(pow(i,i-2,Mod)) Binom=[[0]*(N+1) for _ in range(N+1)] for n in range(N+1): for r in range(n+1): if r==0 or r==n: Binom[n][r]=1 else: Binom[n][r]=(Binom[n-1][r]+Binom[n-1][r-1])%Mod DP=[[0]*N for _ in range(N+1)] DP[0][0]=1 for n in range(N): for m in range(n+1): for k in range(1,N-n+1): alpha=(Binom[N-n-1][k-1]*X[k])%Mod DP[n+k][m+k-1]+=(DP[n][m]*alpha)%Mod DP[n+k][m+k-1]%=Mod print(*DP[N],sep="\n")