#include"bits/stdc++.h"
using namespace std;
 
#define ll long long
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false)

int main(){
	fastio;

	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		int a[n+1];
		for(int i=1;i<=n;i++) cin>>a[i];
		vector<int>ans;
		for(int i=1;i<=n;i++){
			if(a[i]==1){
				ans.push_back(1);
			}else{
				while(!ans.empty() && ans.back()!=a[i]-1) ans.pop_back();
				ans.pop_back();
				ans.push_back(a[i]);
			}
			for(int j=0;j<ans.size();j++){
				if(j==ans.size()-1) cout<<ans[j];
				else cout<<ans[j]<<".";
			}
			cout<<endl;
		}
	}
}