#include <bits/stdc++.h>
using namespace std;

int n, p[1010], a;

void solve()
{
    cin >> n;
    p[0] = 0;
    for(int i = 1, cnt = 0; i <= n; ++i) {
        cin >> a;
        if(a == 1) {
            p[++cnt] = 1;
        }
        else if(p[cnt] + 1 == a) {
            ++p[cnt];
        }
        else {
            while(p[cnt] + 1 != a)
                --cnt;
            p[cnt]++;
        }
        for(int i = 1; i < cnt; ++i)
            cout << p[i] << '.';
        cout << p[cnt] << '\n';
    }
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL);

    int t;
    for(cin >> t; t--;) {
        solve();
    }

    return 0;
}
