#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<long long, long long>
#define pdd pair<long double, long double>
#define all(x) x.begin(), x.end()
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
const ll mod = 998244353;
const ll N = 1e6 + 5, M = 21;
const ld pi = acos(-1);
    
ll power(ll x, unsigned ll y, ll p) {
        ll res = 1; 
        x = x % p;
        while (y > 0)
        {
            if (y & 1)
                res = (res*x) % p;
            y = y>>1;
            x = (x*x) % p;  
        }
    return res;
}
 
int main() { 
    
    FAST;
    int t;
    cin >> t;
    while(t--) {
        int n;
        cin >> n;
        int a[n];
        for(int i=0;i<n;i++) {
            cin >> a[i];
        }
        string str[n];
        str[0] = "1";
        stack <int> s;
        s.push(0);
        for(int i=1;i<n;i++) {
            if(a[i] == 1) {
                str[i] = str[i - 1] + ".1";
            } else {
                while(!s.empty() && (a[i] - 1) != a[s.top()]) {
                    s.pop();
                }
                int idx = s.top();
                s.pop();
                int id = -1;
                for(int j=str[idx].size()-1;j>=0;j--) {
                    if(str[idx][j] == '.') {
                        id = j;
                        break;
                    }
                }
                if(id == -1) {
                    str[i] = to_string(a[i]);
                } else {
                    str[i] = "";
                    for(int j=0;j<id;j++) {
                        str[i] += str[idx][j];
                    }
                    str[i] += '.';
                    str[i] += to_string(a[i]);
                }
            }
            s.push(i);
        }
        for(int i=0;i<n;i++) {
            cout << str[i] << "\n";
        }
    }
    return 0; 
}