A labeled undirected graph is defined as a simple generalized series-parallel graph if and only if:
- The graph is connected;
- The graph contains no multiple edges or self-loops;
- For any $4$ nodes, there do not exist $6$ paths that are pairwise vertex-disjoint (except at endpoints) connecting every pair of these $4$ nodes.
Let $f(i, j)$ denote the number of simple generalized series-parallel graphs with $i$ vertices and $j$ edges.
Given $n, m, p$, you need to calculate $f(i, j) \bmod p$ for all $1 \leq i \leq n$ and $1 \leq j \leq m$.
Input
A single line containing three positive integers $n, m, p$.
Output
Output $n$ lines, each containing $m$ integers, where the $j$-th integer in the $i$-th line represents the value of $f(i, j) \bmod p$.
Examples
Input 1
5 10 998244353
Output 1
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 3 1 0 0 0 0 0 0 0 0 0 16 15 6 0 0 0 0 0 0 0 0 125 222 205 70 0 0 0
Input 2
See additional files.
Constraints
For all test cases, it is guaranteed that:
- $1 \le n, m \le 50$;
- $10^8 \le p \le 10^9+7$, and $p$ is a prime number.
This problem uses bundled testing.
- Subtask 1 (8 points): $n \le 8$, $m \le 10$.
- Subtask 2 (12 points): $n \le 10$, $m \le 20$.
- Subtask 3 (12 points): $n \le 11$, $m \le 20$.
- Subtask 4 (32 points): $n, m \le 25$.
- Subtask 5 (36 points): No additional constraints.