#include<bits/stdc++.h>
using namespace std;
#define ll   long long  int 
#define pb push_back
#define mod 1000000007 
#define mod1 998244353
#define ld long  double
#define N   200005
#define M 100
#define hell 1e6


 
 /* 
   __                       __                         
  |  \                     |  \                        
 _| ▓▓_   __    __  _______| ▓▓____   ______   ______  
|   ▓▓ \ |  \  |  \/       \ ▓▓    \ |      \ /      \ 
 \▓▓▓▓▓▓ | ▓▓  | ▓▓  ▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓\ \▓▓▓▓▓▓\  ▓▓▓▓▓▓\
  | ▓▓ __| ▓▓  | ▓▓\▓▓    \| ▓▓  | ▓▓/      ▓▓ ▓▓   \▓▓
  | ▓▓|  \ ▓▓__/ ▓▓_\▓▓▓▓▓▓\ ▓▓  | ▓▓  ▓▓▓▓▓▓▓ ▓▓      
   \▓▓  ▓▓\▓▓    ▓▓       ▓▓ ▓▓  | ▓▓\▓▓    ▓▓ ▓▓      
    \▓▓▓▓  \▓▓▓▓▓▓ \▓▓▓▓▓▓▓ \▓▓   \▓▓ \▓▓▓▓▓▓▓\▓▓      
                                                       
                                                       
   */


 
 // mid = lo + (hi-lo+1)/2   bin search; 
 
        

void dynamic()
{
int n;
cin>>n;
vector<int> v;
int x;
cin>>x;
cout<<x<<"\n";
v.push_back(x);
for(int i=1;i<n;i++)
{
  int y;
  cin>>y;
  if(y==1)
  {
    v.push_back(1);
    for(int j=0;j<v.size();j++)
    {
      if(j!=v.size()-1)
      {
        cout<<v[j]<<".";
      }
      else
      {
        cout<<v[j]<<"\n";
      }
    }
continue;
  }
  int it=0;
  for(int j=v.size()-1;j>=0;j--)
  {
    if(y==v[j]+1)
    {
      v[j]=y;
      it=j+1;
      break;
    }

  }
  if(it!=v.size())
  {
    v.erase(v.begin()+it,v.end());
  }
  for(int j=0;j<v.size();j++)
    {
      if(j!=v.size()-1)
      {
        cout<<v[j]<<".";
      }
      else
      {
        cout<<v[j]<<"\n";
      }
    }

}



}

int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);

int t;
cin>>t;


while(t--)
{
  dynamic();

}


}