#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int P[N], W[N];
char S[N];
int main()
{
    int T, n;
    scanf("%d", &T);
    while (T--)
    {
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", P + i);
        for (int i = 1, j = 1; i <= n; i++)
        {
            for (int k = P[i] - P[i - 1]; k; k--)
                S[j++] = '(';
            S[j++] = ')';
        }
        for (int i = 1, j = 1; i <= (n << 1); i++)
            if (S[i] == ')')
            {
                int w = 0;
                for (int k = i - 1, c = 1; c; k--)
                    if (S[k] == '(')
                        c--, w++;
                    else
                        c++;
                W[j++] = w;
            }
        for (int i = 1; i <= n; i++)
            printf("%d%c", W[i], " \n"[i == n]);
    }
    return 0;
}
