#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mod 1000000007
#define int long long

typedef pair<int,int> Pair;


void test()
{
	int n;
	cin>>n;
	int arr[n];
	vector<pair<int,string>> ans;
	for (int i = 0; i < n; i++)
	{
		cin>>arr[i];
	}
	stack<pair<int,string>> q;
	string s = "";
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		if(arr[i] == count+1)
		{
			count++;
			ans.push_back({count,s});
		}
		else if(arr[i] == 1){
			s.append(to_string(count)+".");
			q.push({count,s});
			count = 1;
			ans.push_back({count,s});
		}
		else{
			pair<int,string> p = q.top();

			q.pop();
			while(arr[i] != p.first+1)
			{
				p = q.top();
				q.pop();
			}
			s = p.second;
			s.pop_back();
			for (int i = s.size()-1; i >= 0; i--)
			{
				if(s[i] == '.') break;
				s.pop_back();
			}
			count = p.first+1;
			ans.push_back({count,s});
		}
	}
	for (int i = 0; i < ans.size(); i++)
	{
		cout<<ans[i].second<<ans[i].first<<"\n";
	}
	

}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		test();
	}
	return 0;
}

