A positive integer sequence A is considered good if and only if the following conditions are satisfied:
1. The length of A equals to n.
2. Suppose that k is the maximum value of A, A should contain [1,2,3...k-1,k] as a subsequence.
A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
First, Pty wants to know the number of good sequences.
Second, for each integer x ∈ [1,n], Pty also wants to know the occurrence number of x in all good sequences.
Since the answers might be very large, print the answers modulo p.
There are T test cases in total.