//Classic
// //g++ -std=c++17 -O2 -Wall a.cpp -o test
// _()_
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vll vector<ll>
#define vi vector<int>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define vp vector<pi>
#define vpll vector<pll>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
//#define endl "\n"
#define debug2(x,y) cout<<"This side ----> "<<#x<<" -> "<<x<<" | "<<#y<<" -> "<<y<<endl;
#define debug(x) cout<<"This side    ----> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define mint map<int,int>
#define mall map<ll,ll>
#define ciN cin
#define gu(a,s) get<a>(s)
#define tin tuple<ll,ll,ll>
#define ter(x,y,z) ((x)?y:z)
#define ul ll
/////////////

const ll maxn = 5e3 + 5;
const ll max_val = 2e5 + 10;
ll mod = 1e9 + 7;
const ll bits = 20;
ll caseNumber = 1;
////////////////////////////////////////////////////////////////

void jabru() {
	int n; cin >> n;
	vi v(n);
	for (int i = 0; i < n; i++)cin >> v[i];
	stack<vi>s;
	s.push({1});
	cout << 1 << endl;
	for (int j = 1; j < n; j++) {
		if (v[j] == 1) {
			vi x = s.top();
			x.pb(v[j]);
			s.push(x);
			for (int k = 0; k < s.top().size(); k++) {
				if (k == s.top().size() - 1) {
					cout << s.top()[k];
				}
				else {
					cout << s.top()[k] << ".";
				}
			}
			cout << endl;
		}
		else {
			int rem = s.top().back();
			if (rem + 1 == v[j]) {
				vi x = s.top();
				s.top().back() = v[j];
				for (int k = 0; k < s.top().size(); k++) {
					if (k == s.top().size() - 1) {
						cout << s.top()[k];
					}
					else {
						cout << s.top()[k] << ".";
					}
				}
				cout << endl;
			}
			else {
				s.pop(); j--;
			}
		}
	}

}



bool TestCase = 1;
bool isGoogles = 0;



//////////////////////////////////////////////////////////////////




//////////////////////////////////////////////////////////

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll t;
	t = 1;
	if (TestCase) {
		cin >> t;
	}
	while (t--) {
		if (isGoogles) {cout << "Case #" << caseNumber << ": ";} caseNumber++;
		jabru();

	}
	return 0;
}