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

// Dont stuck on one approach
// Dont spam submissions in panik
// Dont give up ... Think more

#define mod 1000000007
#define ll long long
#define pb push_back
#define FLASH ios_base::sync_with_stdio(false), cin.tie(NULL);
#define filething freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define float long double
#define int long long

void solve(){
   int n;
   cin >> n;
   
   int stage = 0;
   vector <int> v[n];
   for(int i = 0; i < n; i ++){
       int k;
       cin >> k;
       
       if(i == 0){
           cout << 1 << endl;
           stage ++;
           v[0].pb(1);
           continue;
       }
       if(k == 1){
           for(int j = 0; j < stage; j ++){
               v[i].pb(v[i - 1][j]);
               cout << v[i - 1][j] << ".";
           }
           v[i].pb(1);
           cout << 1 << endl;
           stage ++;
       }
       else{
           for(int j = stage - 1; j >= 0; j --){
               if(v[i - 1][j] == k - 1){
                   stage = j + 1;
                   for(int jj = 0; jj < j; jj ++){
                       v[i].pb(v[i - 1][jj]);
                       cout << v[i - 1][jj] << ".";
                   }
                   v[i].pb(k);
                   cout << k << endl;
                   break;
               }
           }
       }
   }
}
    
signed main(){
    
    FLASH
    
    int t;
    cin >> t;
    // t = 1;
    
    while(t --){
        solve();
    }
    return 0;
}
