/**
* @author: Prasad Chaudhari
* @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
* @git: https://github.com/Prasad-Chaudhari
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;

public class Main {

    public static void main(String[] args) throws Exception {
        FastIO in = new FastIO(args);
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            LinkedList<Integer> l = new LinkedList<>();
            ArrayList<LinkedList<Integer>> al = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                int p = in.ni();
                if (p == 1) {
                    l.addFirst(1);
                } else {
                    while (true) {
                        if (l.peekFirst() == p - 1) {
                            l.addFirst(l.removeFirst() + 1);
                            break;
                        } else {
                            l.removeFirst();
                        }
                    }
                }
                al.add(new LinkedList<>(l));
            }
            for (LinkedList<Integer> ll : al) {
                while (ll.size() > 1) {
                    System.out.print(ll.removeLast() + ".");
                }
                System.out.println(ll.remove());
            }
            System.out.println();
        }
        in.bw.flush();
    }

    static boolean willbealive(int i, int a[]) {
        if (i < 0 || i >= a.length)
            return false;
        if (a.length == 1)
            return false;
        if (a[i] == 1)
            return false;
        if (i == 0)
            return a[1] == 1;
        else if (i == a.length - 1)
            return a[i - 1] == 1;
        else
            return (a[i - 1] == 1) ^ (a[i... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?