#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define INF 1000000000
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define tr(c, i) for (auto i = c.begin(); i != c.end(); i++)
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c), x) != c.end())
#define endl '\n'

void solve()
{
    int i,n,levelcount = 0, ara[100005] = {0},x;
    cin >> n;

    while (n--)
    {

        cin >> x;

        if (x == 1)
        {
            levelcount++;
            ara[levelcount] = 1;
        }

        else
        {

            for (i = levelcount; i > 0; i--)
            {
                if (ara[i] + 1 == x)
                {
                    levelcount = i;
                    ara[i] = x;
                    break;
                }
            }
        }

        for (i = 1; i <= levelcount; i++)
        {
            cout << ara[i];
            if (i != levelcount)
                cout << '.';
        }
        cout << endl;
    }
}

int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);

    //while(1)
    //solve(); return 0;

    ll T, cs;
    cin >> T;
    for (cs = 1; cs <= T; cs++)
    {
        //printf("Case #%lld: ", cs);
        solve();
    }
    return 0;
}