import java.util.*;
import java.io.*;
import java.text.*;

public class CF_1523_C{
    //SOLUTION BEGIN
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int N = ni();
        int[] A = new int[N];
        for(int i = 0; i< N; i++)A[i] = ni();

//        Stack<Integer> stack = new Stack<>();
        int[] stack = new int[2*N];
        int sz = 0;
        for(int i = 0; i< N; i++){
            if(A[i] == 1)stack[sz++] = 1;
            else{
                while (sz > 0 && stack[sz-1]+1 != A[i])sz--;//!stack.isEmpty() && stack.peek()+1 != A[i])stack.pop();
                hold(sz != 0);
                stack[sz-1]++;
                hold(stack[sz-1] == A[i]);
            }
            hold(sz != 0);
            StringBuilder st = new StringBuilder();
            for(int s = 0; s< sz; s++){
                st.append(stack[s]);
                if(s+1 < sz)st.append(".");
            }
            pn(st.toString());
        }
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}
    final long IINF = (long)1e17;
    final int INF = (int)1e9+2;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = true, memory = true, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        if (fileIO) {
            in = new FastReader("");
            out = new PrintWriter("");
        } else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //Solution Credits: Taranpreet Singh
        int T = multipleTC? ni():1;
        pre();
        for (int t = 1; t <= T; t++) solve(t);
        out.flush();
        out.close();
       ... What is the time complexity of the previous code?