#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define mod 1000000007

ll p[100005],q[100005],n;

void print(ll d)
{
	ll i;
	for(i=1;i<=d;i++)
	{
		printf("%lld",p[i]);
		if(i!=d) printf(".");
		else printf("\n");
	}
	return;
}

int main()
{
	ll t,i,j;
	cin>>t;
	while(t--)
	{
		scanf("%lld",&n);
		
		ll dep=0,now;
		
		p[0]=1;
		
		for(i=1;i<=n;i++)
		{
			scanf("%lld",&now);
			
			if(now==1)
			{
				dep++;
				p[dep]=1;
				print(dep);
			}
			else
			{
				while(p[dep]!=now-1) dep--;
				p[dep]=now;
				print(dep);
			}
		}
		
	}
	
	return 0;
}
