#include<iostream>
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    
    while(t--)
    {
        ll n;
        cin>>n;
        
        ll a[n];
        
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
        }
        cout<<"1\n";
        stack<ll> s1,s2,s3;
        s1.push(1);
        
        for(ll i=1;i<n;i++)
        {
            if(a[i] == 1)
            s1.push(a[i]);
            else
            {
                while(s1.top() != a[i]-1)
                s1.pop();
                
                s1.pop();
                s1.push(a[i]);
            }    
                s3=s1;
                while(!s3.empty())
                {
                    s2.push(s3.top());
                    s3.pop();
                }
                
              
            
              while(s2.size()>1)
                {cout<<s2.top()<<".";
                 s2.pop();
                }
                cout<<s2.top();
                s2.pop();
                cout<<"\n";
        }
    }
	return 0;
}
