#include "bits/stdc++.h"

using namespace std;

const long long SZ = 1e5 + 7;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
const long long MOD = 998244353;

#define int                 long long
#define pb                  push_back
#define mp                  make_pair
#define fi                   first
#define se                  second
#define all(X)              (X).begin(), (X).end()
#define allr(X)             (X).rbegin(), (X).rend()
#define sz(X)               (int)X.size()
#define mem0(X)             memset((X), 0, sizeof((X)))
#define mem1(X)             memset((X), -1, sizeof((X)))
#define setbits(X)          __builtin_popcountll(X)
#define fix(X)               fixed << setprecision(X)
#define endl                '\n'

void go(const vector<int> &a, vector<int> &ans, int &idx) {
    for (int i = 1;; ++i) {
        if (idx == sz(a) || a[idx] != i) {
            return;
        }
        for (auto x: ans) {
            cout << x << ".";
        }
        cout << i << endl;
        ans.pb(i);
        idx++;
        go(a, ans, idx);
        ans.pop_back();
    }
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> ans;
    int idx = 0;
    go(a, ans, idx);
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--) solve();
    return 0;
}