#include<bits/stdc++.h>

#define int long long
#define pub push_back
#define pob pop_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;++i)
#define frk(i,n,k) for(int i=k;i<n;++i)
#define frn(i,n,k) for(int i=n-1;i>=k;--i)
#define all(v) (v).begin(),(v).end()
#define sz(v) (v).size()
#define F first
#define S second

using namespace std;

const int mod=1000000007, N = 2e5 + 10;

void solve() {
    int n;
    cin >> n;
    int b[n];
    vector<int> a;
    cin >> b[0];
    cout << "1\n";
    frk(i,n,1)
    {
        cin >> b[i];
        if(b[i]==1)
        {
            for(auto j:a)
                cout << j << ".";
            cout << b[i-1] << ".1\n";
            a.pub(b[i-1]);
        }
        else if(b[i]==b[i-1]+1)
        {
            for(auto j:a)
                cout << j << ".";
            cout << b[i] << endl;
        }
        else
        {
            for(int j=sz(a)-1;j>=0;--j)
            {
                if(b[i]==a[j]+1)
                {
                    a.pop_back();
                    break;
                }
                a.pop_back();
            }
            for(auto j:a)
                cout << j << ".";
            cout << b[i] << endl;
        }
    }

}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int t=1;
    cin >> t;
    fr(i,t) solve();
    return 0;
}