#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    vector< vector<vector<int>>>ans;
    for (int i = 0; i < t; ++i){
        vector<int>mas;
        int n;
        cin >> n;

        for (int j = 0; j < n; ++j){
            int a;
            cin >> a;
            mas.push_back(a);
        }
        vector<vector<int>>otv;
        vector<int>dp(n+1,1);
        int now = -1;
        for (int j = 0; j < n; ++j){
            vector<int>d;
            if (now==-1) {
                d.push_back(mas[j]);
                otv.push_back(d);
                now = 0;
                continue;
            }
            if (mas[j] == 1){
                for (int k = 0; k <= now; ++k){
                    d.push_back(dp[k]);
                }
                d.push_back(1);
                otv.push_back(d);
                now++;
                continue;
            }

            while (mas[j]-dp[now]!=1){
                dp[now] = 1;
                --now;

            }

            dp[now]++;
            for (int k = 0; k <= now; ++k){
                d.push_back(dp[k]);
            }
            //d.push_back(mas[j]);
            otv.push_back(d);
            //cout << now << endl;
        }

        ans.push_back(otv);
    }
    for (int i  = 0; i < t; ++i){
        for (int j = 0; j < ans[i].size(); ++j){
            for (int k = 0; k < ans[i][j].size()-1; ++k){
                cout << ans[i][j][k] << ".";
            }
            cout << ans[i][j][ans[i][j].size()-1] << endl;
        }
    }


    return 0;
}
