#include<bits/stdc++.h>
#define int long long 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
s.find_by_order(x) xth element in set
x.order_of_key(x) number of elements <x*/
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower)
#define upper_string(s) transform(all(s),s.begin(),::toupper)
#define len(s) (int)s.size()
#define F first
#define S second
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
const int MOD=1e9+7;
void print(vi p)
{
	if(len(p)==1)
	cout<<p[0];
	else
	{
		cout<<p[0];
		for(int i=1;i<len(p);i++)
		cout<<"."<<p[i];
	}
}
void solve()
{
int n;
cin>>n;
vi p;
for(int i=1;i<=n;i++)
{
	int x;
	cin>>x;
	if(p.empty())
	{
		p.pb(x);
	}
	else
	{
		vi k;
		int no=0;
		
		
		 int last=-1;
		for(int j=len(p)-1;j>=0;j--)
		{
			if(p[j]+1==x)
			{
				last=j;
				no=1;
				break;
			}
			
		}
	for(int i=0;i<last;i++)
	k.pb(p[i]);
	if(no)
	k.pb(p[last]+1);
		if(!no)
		{
			k=p;
			k.pb(1);
		}
		p=k;
		
//		print(p);
	}
	print(p);
	cout<<endl;
}
}
signed main()
{
//code
fastio
int t=1;
cin>>t;
while(t--)
{
solve();
//cout<<endl;
}
}

