#include <bits/stdc++.h>
using namespace std;


#define int                long long int
#define fi                first
#define se                second
#define pb                push_back
#define rep(i,a,n)        for(int i = a;i < n;i++)
#define vec               vector<int>
#define read(v,n)         rep(i,0,n) {cin>>v[i];}
#define pii               pair<int,int>
#define mpp               make_pair(a,b)
#define write(a,n)        rep(i,0,n) {cout<<a[i]<<" ";}cout<<endl;
#define all(v)            v.begin(),v.end()
#define srt(v)            sort(v.rbegin(),v.rend())
#define scn(a)            cin>>a
#define nl                endl
#define dbug(x)          cout << (#x) << " is " << (x) << endl
#define gcd(a,b)          __gcd(a,b)
#define bitcount(n)       __builtin_popcount(n)
#define IOS               ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod               1000000007



//============================SOLUTION====================================


void solve()
{
	int sz;
	cin >> sz;

	stack<int>st;
	rep(ss, 0, sz)
	{
		int num;
		cin >> num;

		if (num != 1)
		{
			while (st.size() && (st.top() + 1) != num)
			{
				st.pop();
			}

			if (st.size())
				st.pop();
		}
		st.push(num);
		vec check;
		while (st.size())
		{
			check.pb(st.top());
			st.pop();
		}
		// cout << check.size() << endl;
		reverse(all(check));
		rep(i, 0, check.size())
		{
			if (i != 0)
			{
				cout << ".";
			}
			cout << check[i];
		}
		cout << endl;
		rep(i, 0, check.size())
		{
			st.push(check[i]);
		}
	}
}



//==============TEST-CASES================================================
signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	cin >> t;
	for (int i = 1; i <= t; i++)
	{
		solve();
	}
#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}
