#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <algorithm>
#include <climits>
#include <stack>
#include <set>
#define DB double
#define LL long long
#define int LL 
#define GG printf("GG\n")
#define dbg(a) cout<<"DBG = "<<a<<endl
#define enter putchar('\n')
#define space putchar(' ')
using namespace std;
const int N = 1e3 + 10;
const int M = 1e2 + 10;
const int MOD = 1e6;
void debug(int last) {
}
int sum[N], ans[N];
void solve() {
	memset(sum, 0, sizeof(sum));
	memset(ans, 0, sizeof(ans));
	int n;
	cin >> n;
	int dep = 0;
	for (int i = 1; i <= n; i++) {
		int x; cin >> x;
		if (x == 1) {
			dep += 1;
			sum[dep] = 1;
			ans[i] = dep;
		}
		else if (x == sum[dep] + 1) {
			sum[dep]++;
			ans[i] = dep;
		} else {
			while (x != sum[--dep] + 1) {
				sum[dep + 1] = 0;
			}
			sum[dep]++;
			ans[i] = dep;
		}
		cout << sum[1];
		for (int j = 2; j <= ans[i]; j++) {
			cout << "." << sum[j];
		}
		cout << '\n';
	}
}
signed main(){
#ifdef _DEBUG
	freopen("out.out", "w", stdout);
#endif
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int T; cin >> T;
	while (T--) solve();
	return 0;
}
