#include<bits/stdc++.h> 
#define MODULO 1000000007
using namespace std; 
void solve(); 
long long int permutationCoeff(int n, int k); 

void displayArr(vector<int> &array) {
	for(int i = 0; i < array.size(); i++) {
		cout<<array[i]<<" ";
	}
	cout<<endl;
}

int main()
{ 
   ios_base::sync_with_stdio(false);cin.tie(NULL); 
   
   #ifndef ONLINE_JUDGE 
   freopen("input.txt", "r", stdin); 
   freopen("error.txt", "w", stderr); 
   freopen("output.txt", "w", stdout); 
   #endif 
  
   int t; 
   cin>>t;
   while(t--) 
   { 
      solve();
   } 
   
   cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl; 
   return 0; 
} 

void printstack(vector<int> A) {
	for(int i = 0; i < A.size()-1; i++) {
		cout<<A[i]<<".";
	}
	cout<<A[A.size()-1]<<endl;
	return;
} 

void solve(){
	vector<int> stack;
	int n;
	cin>>n;
	for(int i = 0; i < n; i++) {
		int val;
		cin>>val;
		if(val == 1) {
			stack.push_back(1);
		} else if(stack[stack.size()-1] + 1 == val) {
			stack.pop_back();
			stack.push_back(val);
		} else {
			while(stack[stack.size()-1] + 1 != val) {
				stack.pop_back();
			}
			stack.pop_back();
			stack.push_back(val);
		}
		printstack(stack);
	}
	return;
}
