#include<bits/stdc++.h>
using namespace std;


vector<int>v,s;

int main()
{
    ios::sync_with_stdio(false);
    int t;
    cin>>t;
    while(t--)
    {
        v.clear();
        s.clear();
        int n;
        cin>>n;
        for(int i=0; i<n; i++)
        {
            int x;
            cin>>x;
            v.emplace_back(x);
        }
        int top=-1;
        for(int i=0; i<n; i++)
        {
            int now=v[i];
            if(top==-1)
            {
                top++;
                if(s.size()>top)
                    s[top]=now;
                else
                    s.emplace_back(now);
                for(int j=0;j<=top;j++)
                {
                    if(j==0)
                        cout<<s[j];
                    else
                        cout<<"."<<s[j];
                }
                cout<<"\n";
            }
            else if(now==1)
            {
                top++;
                if(s.size()>top)
                    s[top]=now;
                else
                    s.emplace_back(now);
                for(int j=0;j<=top;j++)
                {
                    if(j==0)
                        cout<<s[j];
                    else
                        cout<<"."<<s[j];
                }
                cout<<"\n";
            }
            else
            {
                while(s[top]!=now-1)
                {
                    top--;
                }
                s[top]=now;
                for(int j=0;j<=top;j++)
                {
                    if(j==0)
                        cout<<s[j];
                    else
                        cout<<"."<<s[j];
                }
                cout<<"\n";
            }
        }
    }

    return 0;
}
