#include <iostream>
#include <vector>
#include <set>
#include <string>

#define fastIO() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
#define ll long long
#define forLoop(start, n) for(ll i = start; i < (n); ++i)
#define vecInt std::vector<int>

void printVec(const vecInt& vec)
{
    std::string str = "";
    forLoop(0, vec.size())
    {
        str += std::to_string(vec[i]) + ".";
    }
    str.pop_back();
    std::cout << str << std::endl;
}

void process()
{
    ll n{};
    vecInt a{};
    vecInt b{};
    std::cin >> n;
    a.resize(n);
    forLoop(0, n)
        std::cin >> a[i];

    b.push_back(1);
    printVec(b);

    forLoop(1, n)
    {
        if (a[i] == 1)
        {
            b.push_back(1);
        }
        else
        {
            while (b.size() - 1 > 0 && a[i] - b[b.size() - 1] != 1)
            {
                b.pop_back();
            }
            b.pop_back();
            b.push_back(a[i]);
        }
        printVec(b);
    }
}

int main(int argc, char* argv[])
{
    fastIO();
    ll t;
    std::cin >> t;
    while (t--)
    {
        process();
    }
    return 0;
}