Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author wilso
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class codeforces {
    static final long MOD2 = 998_244_353;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
       
        int tc = sc.ni();
//        int tc = 1;
        for (int rep = 0; rep < tc; rep++) {
            int N = sc.ni();
            int[] arr = sc.intArray(N);
            pw.println(solve(arr));
        }
        
        pw.close();
    }
 
    
    static String solve(int[] arr) {
        StringBuilder sb = new StringBuilder();
        List<Integer> list = new ArrayList();
        list.add(0);
        for (int i = 0; i < arr.length; i++) {
            int x = arr[i];
            for (int j = list.size() - 1; j >= 0; j--) {
                if (x - 1 == list.get(j)) {
                    list.set(j, x);
                    while (list.size() > j+1) {
                        list.remove(list.size() - 1);
                    }
                    list.add(0);
                    
                    //append
                    for (int idx = 0; idx < list.size() - 1; idx++) {
                        sb.append(list.get(idx) + ".");
                    }
                    sb.setLength(sb.length() - 1);
                    sb.append("\n");
                    break;
                }
            }
        }
        sb.setLength(sb.length() - 1);
        return sb.toString();
    }
   
    static int summation(int x) {
        return x * (x+1) / 2;
    }  
    static long pow(long num, long exp, long mod){
        long ans=1;
        for(int i=1;i<=exp;i++){
            ans=(ans*num)%mod;
        }
        return ans;
    }
    static boolean... Complexity: