#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef vector<vi> vii;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  int t; cin >> t;
  while(t--){
  	int n; cin >> n;
  	vector <int> v(n);
  	forn(i, n){
  		cin >> v[i];
  	}
  	vector <vector<int>> an(n);
  	forn(i, n){
  		if(!i){
  			an[i].pb(v[i]);
  			continue;
  		}
  		if(v[i] ==  1){
  			an[i] = an[i - 1];
  			an[i].pb(1);
  			continue;
  		}
  		
  		int nn = sz(an[i - 1]);
  		an[i] = an[i-1];
  		for(int j = nn - 1; j >= 0; j--){
  			if(an[i][j] + 1 == v[i]){
  				an[i][j]++;
  				break;
  			}
  			else{
  				an[i].pop_back();
  			}
  		}
  	}
  	forn(i, n){
  		int k = 0;
  		for(auto j: an[i]){
  			if(k == 0){
  				cout << j;
  				k = 1;
  			}
  			else{
  				cout << "." << j;
  			}
  		}
  		cout << endl;
  	}
  }
  return 0;
}