#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int((x).size())) #define bit(x) (1 << (x)) #define cnt1(x) (__builtin_popcount(x)) template inline void chkmax(T& x, U y) { if (x < y) x = y; } template inline void chkmin(T& x, U y) { if (y < x) x = y; } typedef long long LL; typedef double DB; typedef pair PII; typedef vector VI; const int M = 1000000007; const int MX = 55; LL C[MX][MX]; int a[MX], n; int dp[MX][MX][MX]; inline void add(int& x, int y) { x += y; if (x >= M) x -= M; } void init() { int i, j; for (i = 0; i < MX; i++) { C[i][0] = 1; for (j = 1; j <= i; j++) { C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % M; } } } int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); int tc, i, j, k, d, tp; init(); for (scanf("%d", &tc); tc--; ) { scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); a[i]--; } memset(dp, 0, sizeof dp); dp[0][0][0] = 1; for (i = 0; i < n; i++) { for (j = 0; j <= n; j++) { for (k = 0; k <= n; k++) { tp = dp[i][j][k]; if (!tp) continue; add(dp[i + 1][j][k], tp); for (d = min(n - k, a[i]); d >= 0; d--) { add(dp[i + 1][j + 1][k + d], tp * C[k + d][d] % M); } } } } printf("%d", n); for (i = 2; i <= n; i++) printf(" %d", dp[n][i][i - 2]); puts(""); } return 0; }