#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read(){
	int r=0,f=1;
	char c=getchar();
	while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
	while(c>=48&&c<=57)r=r*10+(c&15),c=getchar();
	return r*f;
}
inline void write(int x){
	char c[20],len=0;
	if(!x){putchar('0');return;}
	if(x<0)x=-x,putchar('-');
	while(x)c[len++]=x%10,x/=10;
	while(len)putchar(c[--len]+48);
}
#define space(x) write(x),putchar(' ')
#define enter(x) write(x),putchar('\n')

const int N=1010;
int n,a[N];
bool vis[N];
vector<int> ans[N];
void solve(){
	n=read(),a[1]=read();
	ans[1].clear(),ans[1].push_back(1);
	memset(vis,0,sizeof(bool)*(n+1));
	puts("1");
	for(int i=2;i<=n;++i){
		a[i]=read();
		for(int j=i-1;j;--j)
			if(!vis[j]){
				if(a[i]==1){
					ans[i]=ans[j],ans[i].push_back(1);
					break;
				}
				vis[j]=1;
				if(a[i]==a[j]+1){
					ans[i]=ans[j],ans[i].pop_back(),ans[i].push_back(a[i]);
					break;
				}
			}
		for(int j=0;j<ans[i].size();++j)
			printf("%d%c",ans[i][j],".\n"[j==ans[i].size()-1]);
	}
}

int main(){
	int T=read();
	while(T--)solve();
}