#include <bits/stdc++.h>
#include <chrono> 

using namespace std;
using namespace std::chrono; 

#define f0r(a, b) for (long long a = 0; a < (b); ++a)
#define f1r(a, b, c) for (long long a = (b); a < (c); ++a)
#define f0rd(a, b) for (long long a = (b); a >= 0; --a)
#define f1rd(a, b, c) for (long long a = (b); a >= (c); --a)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define pb push_back
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL); cout.tie(NULL);}
#define fix(prec) {cout << setprecision(prec) << fixed;}
#define mp make_pair
#define f first
#define s second
#define all(v) v.begin(), v.end()
#define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());}
#define readgraph(list, edges) for (int i = 0; i < edges; i++) {int a, b; cin >> a >> b; a--; b--; list[a].pb(b); list[b].pb(a);}
#define ai(a, n) for (int ele = 0; ele < n; ele++) cin >> a[ele];
#define ain(a, lb, rb) for (int ele = lb; ele <= rb; ele++) cin >> a[ele];
#define ao(a, n) {for (int ele = 0; ele < (n); ele++) { if (ele) cout << " "; cout << a[ele]; } cout << '\n';}
#define aout(a, lb, rb) {for (int ele = (lb); ele <= (rb); ele++) { if (ele > (lb)) cout << " "; cout << a[ele]; } cout << '\n';}
#define vsz(x) ((long long) x.size())

typedef long long ll;
typedef long double lld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

// const lld pi = 3.14159265358979323846;
// const ll N = 1000000007;

void solve(int t) {
	int n;
	cin>>n;
	int x;
	vector<int> myTree;
	for(int i=0;i<n;i++){
		cin>>x;
		if(x==1){
			myTree.push_back(x);
		}
		else{
			int len = myTree.size();
			for(int j=len-1;j>=0;j--){
				if(myTree[j]==(x-1)){
					myTree[j]++;
					break;
				}
				else{
					myTree.pop_back();
				}
			}
		}
		cout<<myTree[0];
		for(int j=1;j<(int)myTree.size();j++){
			cout<<'.'<<myTree[j];
		}
		cout<<'\n';
	}
}

int main() {
	//auto begin = std::chrono::high_resolution_clock::now();
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int T;
	cin >> T;
	for (int t = 0; t < T; t++){
        solve(t);
    }
	
	//auto end = std::chrono::high_resolution_clock::now();
	//cout << setprecision(4) << fixed;
	// cout << "Execution time: " << std::chrono::duration_cast<std::chrono::duration<double>>(end - begin).count() << " seconds" << endl;
}