#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int mx = 1e5 + 2;
const ll mod = 1e9 + 7;


ll power(ll a, unsigned ll b, ll p = mod)
{
    ll res = 1;
    a = a % p;

    if (a == 0)
        return 0;

    while(b)
    {
        if(b & 1)
            res = (a * res) % p;

        b = b >> 1;
        a = (a*a) % p;
    }

    return res;
}

ll issqr(ll a)
{
    double sqr = sqrt(a);
    if(ceil(sqr) == floor(sqr))
        return true;
    else
        return false;
}


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

    int tt;
    cin >> tt;
    for (int pp = 0; pp < tt; pp++)
    {
        int n;
        cin >> n;
        int a[n];
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }

        vector <ll> s;
        for (int i = 0; i < n; i++)
        {
            if(s.empty())
            {
                s.push_back(a[i]);
            }
            else
            {
                int last = s[s.size() - 1];
                if(a[i] == 1)
                {
                    s.push_back(a[i]);
                }
                else if(a[i] == last + 1)
                {
                    s.pop_back();
                    s.push_back(a[i]);
                }
                else 
                {
                    while (!s.empty() && s[s.size() - 1] != a[i] - 1)
                    {
                        s.pop_back();
                    }
                    if(!s.empty())
                        s.pop_back();
                    s.push_back(a[i]);
                }
            }
            for (int j = 0; j < s.size(); j++)
            {
                cout << s[j];
                if(j != s.size() - 1)
                    cout <<".";
            }
            cout << endl;
            
        }
        
        
    }
    
}
