#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 3.1415926535897932384626433

int main() {
    ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        stack<pair<int,string> > s;
        for(int i = 0; i < n; i++) {
            int a;
            cin>>a;
            if(i == 0){
                cout<<1<<endl;
                pair<int,string> p;
                p.first = 1;
                p.second  = "1";
                s.push(p);
                continue;
            }
            if(a == 1){
                string curr = s.top().second + "." + to_string(a);
                pair<int,string> p;
                p.first = 1;
                p.second  = curr;
                s.push(p);
                cout<<curr<<endl;
                continue;
            }
            while(s.size() > 0){
                if(s.top().first == a-1) break;
                else s.pop();
            }
            string curr = s.top().second;
            while(curr.length() > 0 && curr[curr.length()-1]!='.') {
                curr.pop_back();
            }
            curr = curr + to_string(a);
            s.pop();
            pair<int,string> p;
            p.first = a;
            p.second  = curr;
            s.push(p);
            cout<<curr<<endl;
            

        }
    }
    
}
   
 
 
