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();
        System.err.println(System.currentTimeMillis() - ct);
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new CF_1523_C().run();}catch(Exception e){e.printStackTrace();System.exit(1);}}}, "1", 1 << 28).start();
        else new CF_1523_C().run();
    }
    int[][] make(int n, int e, int[] from, int[] to, boolean f){
        int[][] g = new int[n][];int[]cnt = new int[n];
        for(int i = 0; i< e; i++){
            cnt[from[i]]++;
            if(f)cnt[to[i]]++;
        }
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];
        for(int i = 0; i< e; i++){
            g[from[i]][--cnt[from[i]]] = to[i];
            if(f)g[to[i]][--cnt[to[i]]] = from[i];
        }
        return g;
    }
    int[][][] makeS(int n, int e, int[] from, int[] to, boolean f){
        int[][][] g = new int[n][][];int[]cnt = new int[n];
        for(int i = 0; i< e; i++){
            cnt[from[i]]++;
            if(f)cnt[to[i]]++;
        }
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];
        for(int i = 0; i< e; i++){
            g[from[i]][--cnt[from[i]]] = new int[]{to[i], i, 0};
            if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i, 1};
        }
        return g;
    }
    int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}
    int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object... o){for(Object oo:o)out.print(oo+" ");}
    void pn(Object... o){for(int i = 0; i< o.length; i++)out.print(o[i]+(i+1 < o.length?" ":"\n"));}
    void pni(Object... o){for(Object oo:o)out.print(oo+" ");out.println();out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str;
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}


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

public class Codeforces
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int t=Integer.parseInt(bu.readLine());
        while(t-->0)
        {
            int n=Integer.parseInt(bu.readLine());
            int cur[]=new int[n],i,cr=-1;
            for(i=0;i<n;i++)
            {
                int j,d=Integer.parseInt(bu.readLine()),f=-1;
                for(j=cr;j>=0;j--)
                if(cur[j]==d-1) {f=j; break;}

                if(f==-1)
                {
                    cr++;
                    f=cr;
                }
                cur[f]=d;
                cr=f;
                for(j=f+1;j<n;j++) cur[j]=0;
                sb.append(cur[0]);
                for(j=1;j<n;j++)
                if(cur[j]==0) break;
                else sb.append("."+cur[j]);
                sb.append("\n");
            }
        }
        System.out.print(sb);
    }
}


/*
 * 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 isPrime(int n)
    {

        if (n <= 1)
            return false;
        else if (n == 2)
            return true;
        else if (n % 2 == 0)
            return false;
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            if (n % i == 0)
                return false;
        }
        return true;
    }
    static int gcd(int a, int b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }
    static long gcd(long a, long b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }
    static int lcm(int a, int b)
    {
        return (a / gcd(a, b)) * b;
    }
    public static void sort(int[] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            int temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr);
    }
    public static void sort(long[] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            long temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr);
    }
    static int charint(char c) {
        return Integer.parseInt(String.valueOf(c));
    }

    /* */
    //printing methods
    /* */
    //WOW!
    /* */
    public static void printArr(PrintWriter pw, int[] arr) {
        StringBuilder sb = new StringBuilder();
        for (int x : arr) {
            sb.append(x + "");
        }
        sb.setLength(sb.length() - 1);
        pw.println(sb.toString());
    }
    public static void printArr2d(PrintWriter pw, int[][] arr) {
        StringBuilder sb = new StringBuilder();
        for (int[] row : arr) {
            for (int x : row) {
                sb.append(x + " ");
            }
            sb.setLength(sb.length() - 1);
            sb.append("\n");
        }
        pw.println(sb.toString());
    }
}

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner() {
        br = new BufferedReader(new InputStreamReader(System.in), 32768);
        st = null;
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();

            }
        }
        return st.nextToken();
    }

    int ni() {
        return Integer.parseInt(next());
    }

    int[] intArray(int N) {
        int[] ret = new int[N];
        for (int i = 0; i < N; i++)
            ret[i] = ni();
        return ret;
    }

    long nl() {
        return Long.parseLong(next());
    }

    long[] longArray(int N) {
        long[] ret = new long[N];
        for (int i = 0; i < N; i++)
            ret[i] = nl();
        return ret;
    }

    double nd() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

class MultiSet {
    TreeMap<Long, Integer> map = new TreeMap<>();
    private int size = 0;
    public MultiSet() {
    }
    public void add(Long val) {
        map.put(val, map.getOrDefault(val, 0) + 1);
        size++;
    }
    public void remove(Long val) {
        map.put(val, map.get(val) - 1);
        if (map.get(val) == 0) {
            map.remove(val);
        }
        size--;
    }
    public int size() {
        return size;
    }
    public Long higher(Long val) {
        return map.higherKey(val);
    }
    public Long lower(Long val) {
        return map.lowerKey(val);
    }
    public Long ceiling(Long val) {
        return map.ceilingKey(val);
    }
    public Long floor(Long val) {
        return map.floorKey(val);
    }
    public Long first() {
        return map.firstKey();
    }
    public Long last() {
        return map.lastKey();
    }
    public boolean isEmpty() {
        return map.isEmpty();
    }
}


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

public class q3 {

    public static void main(String[] args) throws Exception {
        // String[] parts=br.readLine().split(" ");
        // int n=Integer.parseInt(parts[0]);
        // int k=Integer.parseInt(parts[1]);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int tests = Integer.parseInt(br.readLine());

        for (int test = 1;test <= tests;test++) {
            String[] parts = br.readLine().split(" ");
            int n = Integer.parseInt(parts[0]);

            StringBuilder temp = new StringBuilder();

            int curr = Integer.parseInt(br.readLine());
            temp.append("1");
            System.out.println(1);
            for(int i = 0;i < n - 1;i++){
                curr = Integer.parseInt(br.readLine());
                if(curr == 1){
                    temp.append('.').append('1');
                    System.out.println(temp);
                }else{
                    while(temp.length() > 0){
                        int idx = temp.length() - 1;
                        while(idx >= 0 && temp.charAt(idx) != '.') idx--;
                        idx++;

                        int val = Integer.parseInt(temp.substring(idx));
                        temp.delete(idx,temp.length());
                        if(curr == val + 1){
                            temp.append(String.valueOf(curr));
                            break;
                        }
                        temp.deleteCharAt(temp.length() - 1);
                    }
                    System.out.println(temp);
                }
            }
        }
    }
}


import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        int n=ni();
        int[]A=new int[n];
        int point = -1;
        for(int _i=0;_i<n;_i++){
            int x =ni();
            if(x==1){
                point++;
                A[point]=1;
            }
            else{
                while(x!=A[point]+1){
                    A[point]=0;
                    point--;
                }
            }
            A[point]=x;
            for(int i=0;i<point;i++)
                p(A[i]+".");
            pn(A[point]);

        }
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        t=ni();
        while(t-- > 0) {process();}
        out.flush();out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}


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

public class tank {

    static final FastScanner fs = new FastScanner();

    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int t = fs.nextInt();
        while(t-->0) {
            run_case();
        }

        out.close();
    }

    static void run_case() {
        int n = fs.nextInt(), prevLen = 1, one = 1;
        int[] arr = fs.readArray(n);
        int[] len = new int[1001];
        StringBuilder[] prev = new StringBuilder[1001];

        len[1] = 1;
        out.println(1);

        for (int i = 0; i < 1001; i++) {
            prev[i] = new StringBuilder();
        }

        prev[1].append("1");

        for (int i = 1; i < n; i++) {
            if(arr[i] == 1) {
                prev[prevLen + 1] = new StringBuilder(prev[prevLen]);
                prev[prevLen + 1].append(".1");
                out.println(prev[prevLen + 1]);

                prevLen++;

                len[prevLen] = 1;
            }else {
                for (int j = 1000; j > 0; j--) {
                    if(len[j] == arr[i] - 1 && j <= prevLen) {
                        char[] tmp = prev[j].toString().toCharArray();

                        if(fn(tmp)) {
                            prev[j] = new StringBuilder("" + (len[j] + 1));
                        }else {
                            prev[j] = new StringBuilder();
                            int ub = fn2(tmp);
                            for (int k = 0; k <= ub; k++) {
                                prev[j].append(tmp[k]);
                            }

                            prev[j].append(len[j] + 1);
                        }

                        out.println(prev[j]);

                        len[j] = len[j] + 1;

                        prevLen = j;
                        break;
                    }

                    if(j == 1) {
                        prev[j] = new StringBuilder("" + (one + 1));

                        out.println(prev[j]);

                        len[j] = one + 1;

                        prevLen = j;

                        one++;
                    }
                }
            }
        }
    }

    static boolean fn(char[] arr) {
        for(char c: arr) {
            if(c == '.') return false;
        }

        return true;
    }

    static int fn2(char[] arr) {
        int ret = 0;

        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == '.') ret = i;
        }

        return ret;
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        String nextLine(){
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }

            return "";
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Random;
import java.util.StringTokenizer;

public final class C {

    static class Node {
        int val;
        String path;
        Node node;

        Node(String p, int t) {
            path = p;
            val = t;
        }
    }

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int t = fs.nextInt();
        final StringBuilder sb = new StringBuilder();
        for (int test = 0; test < t; test++) {
            final int n = fs.nextInt();
            final Deque<Node> dq = new ArrayDeque<>();
            dq.offerLast(new Node("", 0));
            for (int i = 0; i < n; i++) {
                final int next = fs.nextInt();
                if (dq.getFirst().val + 1 != next) {
                    if (next == 1) {
                        final Node peek = dq.getFirst();
                        final String p = peek.path.isEmpty() ? String.valueOf(peek.val)
                                                             : (peek.path + '.' + peek.val);
                        dq.addFirst(new Node(p, 1));
                    } else {
                        while (dq.getFirst().val + 1 != next) {
                            dq.removeFirst();
                        }
                        dq.getFirst().val++;
                    }
                } else {
                    dq.getFirst().val++;
                }
                add(sb, dq.getFirst(), dq.getFirst().val);
            }
        }
        System.out.println(sb);
    }

    private static void add(StringBuilder sb, Node node, int val) {
        final String p = node.path.isEmpty() ? String.valueOf(val)
                                             : (node.path + '.' + val);
        sb.append(p);
        sb.append('\n');
    }

    static final class Utils {
        private static class Shuffler {
            private static void shuffle(int[] x) {
                final Random r = new Random();

                for (int i = 0; i <= x.length - 2; i++) {
                    final int j = i + r.nextInt(x.length - i);
                    swap(x, i, j);
                }
            }

            private static void shuffle(long[] x) {
                final Random r = new Random();

                for (int i = 0; i <= x.length - 2; i++) {
                    final int j = i + r.nextInt(x.length - i);
                    swap(x, i, j);
                }
            }

            private static void swap(int[] x, int i, int j) {
                final int t = x[i];
                x[i] = x[j];
                x[j] = t;
            }

            private static void swap(long[] x, int i, int j) {
                final long t = x[i];
                x[i] = x[j];
                x[j] = t;
            }
        }

        public static void shuffleSort(int[] arr) {
            Shuffler.shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffleSort(long[] arr) {
            Shuffler.shuffle(arr);
            Arrays.sort(arr);
        }

        private Utils() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class C {
    private static FastReader fr = new FastReader();
    private static PrintWriter out=new PrintWriter(System.out);
    private static Random random = new Random();

    public static void main(String[] args) throws IOException {
        StringBuilder sb = new StringBuilder();
        // code goes here
        int t = fr.nextInt();
        while (t-- > 0){
            int n = fr.nextInt();
            int[] arr = fr.nextIntArray(n);
            sb.append(1).append("\n");
            List<Integer> state = new ArrayList<>();
            state.add(1);
            for(int i = 1; i < n; i++){
                List<Integer> nextState = new ArrayList<>();
                boolean found = false;
                int till = -1;
                for(int j = state.size() - 1; j >= 0; j--){
                    if(state.get(j) + 1 == arr[i]){
                        till = j;
                        found = true;
                        break;
                    }
                }
                if(found){
                    for(int j = 0; j < till; j++){
                        nextState.add(state.get(j));
                    }
                    nextState.add(arr[i]);
                    sb.append(nextState.get(0));
                    for(int z = 1; z < nextState.size(); z++){
                        sb.append(".").append(nextState.get(z));
                    }
                    sb.append("\n");
                }
                if(!found){
                    nextState.addAll(state);
                    nextState.add(arr[i]);
                    sb.append(nextState.get(0));
                    for(int z = 1; z < nextState.size(); z++){
                        sb.append(".").append(nextState.get(z));
                    }
                    sb.append("\n");
                }
                state = nextState;
            }
        }
        System.out.print(sb.toString());
    }

    static void ruffleSort(int[] a) {
        int n=a.length;//shuffle, then sort
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }

    static class FastReader{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long[] nextLongArray(int n) {
            long[] a=new long[n];
            for (int i=0; i<n; i++) a[i]=nextLong();
            return a;
        }
    }

    static class Pair<A, B>{
        A first;
        B second;
        public Pair(A first, B second){
            this.first = first;
            this.second = second;
        }
    }

    static long mod(String num, long a)
    {
        // Initialize result
        long res = 0;

        // One by one process all digits of 'num'
        for (int i = 0; i < num.length(); i++)
            res = (res*10 +  num.charAt(i) - '0') %a;

        return res;
    }

    static long binomialCoeff(long n, long k, long MOD)
    {
        long res = 1;

        // Since C(n, k) = C(n, n-k)
        if (k > n - k)
            k = n - k;

        // Calculate value of
        // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
        for (int i = 0; i < k; ++i) {
            res *= (n - i);
            res /= (i + 1);
            res %= MOD;
        }

        return res;
    }

    static long power(long x, long y, long p)
    {

        // Initialize result
        long res = 1;

        // Update x if it is more than or
        // equal to p
        x = x % p;

        while (y > 0) {

            // If y is odd, multiply x
            // with result
            if (y % 2 == 1)
                res = (res * x) % p;

            // y must be even now
            y = y >> 1; // y = y/2
            x = (x * x) % p;
        }

        return res;
    }

    // Returns n^(-1) mod p
    static long modInverse(long n, long p)
    {
        return power(n, p - 2, p);
    }

    // Returns nCr % p using Fermat's
    // little theorem.
    static long nCrModPFermat(int n, int r,
                              long p)
    {

        // Base case
        if (r == 0)
            return 1;

        // Fill factorial array so that we
        // can find all factorial of r, n
        // and n-r
        long[] fac = new long[n + 1];
        fac[0] = 1;

        for (int i = 1; i <= n; i++)
            fac[i] = fac[i - 1] * i % p;

        return (fac[n] * modInverse(fac[r], p)
                % p * modInverse(fac[n - r], p)
                % p)
                % p;
    }
}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;

public class B {

	public static void main(String[] args) throws IOException {

		Reader scan = new Reader();
		int t = scan.nextInt();
		for(int tt = 0;tt<t;tt++) {

			int n = scan.nextInt();
			int arr[] = new int[n];
			for(int i = 0;i<n;i++) arr[i] = scan.nextInt();

			List<Integer> list = new ArrayList<>();
			int j = -1;
			StringBuilder s = new StringBuilder();
			for(int i = 0;i<n;i++) {
				if(list.isEmpty() || arr[i]==1) { //add
					list.add(arr[i]);
					j++;
				}
				else if(arr[i] == list.get(j)+1) { //replace
					list.set(j, arr[i]);
				}
				else {
					for(int k = j;k>=0;k--) {
						if(arr[i] == list.get(k)+1) {//replace
							list.set(k, arr[i]);
							break;
						}
						else {//delete
							list.remove(k);
							j--;
						}
					}
				}
				s.delete(0, s.length());
				for(Integer p:list) {
					s.append(p+".");
				}
				s.deleteCharAt(s.length()-1);
				System.out.println(s.toString());
			}
		}

		scan.close();

	}

	static class Reader
	{
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader()
		{
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException
		{
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException
		{
			byte[] buf = new byte[64]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1)
			{
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException
		{
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
			{
				ret = ret * 10 + c - '0';
			}  while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException
		{
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			}
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException
		{
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			}
			while ((c = read()) >= '0' && c <= '9');

			if (c == '.')
			{
				while ((c = read()) >= '0' && c <= '9')
				{
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException
		{
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException
		{
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException
		{
			if (din == null)
				return;
			din.close();
		}
	}

}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static int MOD = 1000000007;

    // After writing solution, quick scan for:
    //   array out of bounds
    //   special cases e.g. n=1?
    //   npe, particularly in maps
    //
    // Big numbers arithmetic bugs:
    //   int overflow
    //   sorting, or taking max, after MOD
    void solve() throws IOException {
        int T = ri();
        for (int Ti = 0; Ti < T; Ti++) {
            int n = ri();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = ri();
            Deque<int[]> stack = new ArrayDeque<>();
            stack.addLast(new int[]{1});
            pw.println("1");
            for (int i = 1; i < n; i++) {
                if (a[i] == 1) {
                    int[] prev = stack.peekLast();
                    int[] curr = new int[prev.length+1];
                    System.arraycopy(prev, 0, curr, 0, prev.length);
                    curr[curr.length-1] = 1;
                    printArr(curr);
                    stack.addLast(curr);
                    continue;
                }
                while (!stack.isEmpty()) {
                    int[] prev = stack.removeLast();
                    if (a[i] == prev[prev.length-1] + 1) {
                        prev[prev.length-1]++;
                        printArr(prev);
                        stack.addLast(prev);
                        break;
                    } else {
                        continue;
                    }
                }
            }
        }
    }
    // IMPORTANT
    // DID YOU CHECK THE COMMON MISTAKES ABOVE?

    void printArr(int[] a) {
        pw.print(a[0]);
        for (int j = 1; j < a.length; j++) pw.print("." + a[j]);
        pw.println();
    }

    // Template code below

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        Main m = new Main();
        m.solve();
        m.close();
    }

    void close() throws IOException {
        pw.flush();
        pw.close();
        br.close();
    }

    int ri() throws IOException {
        return Integer.parseInt(br.readLine().trim());
    }

    long rl() throws IOException {
        return Long.parseLong(br.readLine().trim());
    }

    int[] ril(int n) throws IOException {
        int[] nums = new int[n];
        int c = 0;
        for (int i = 0; i < n; i++) {
            int sign = 1;
            c = br.read();
            int x = 0;
            if (c == '-') {
                sign = -1;
                c = br.read();
            }
            while (c >= '0' && c <= '9') {
                x = x * 10 + c - '0';
                c = br.read();
            }
            nums[i] = x * sign;
        }
        while (c != '\n' && c != -1) c = br.read();
        return nums;
    }

    long[] rll(int n) throws IOException {
        long[] nums = new long[n];
        int c = 0;
        for (int i = 0; i < n; i++) {
            int sign = 1;
            c = br.read();
            long x = 0;
            if (c == '-') {
                sign = -1;
                c = br.read();
            }
            while (c >= '0' && c <= '9') {
                x = x * 10 + c - '0';
                c = br.read();
            }
            nums[i] = x * sign;
        }
        while (c != '\n' && c != -1) c = br.read();
        return nums;
    }

    int[] rkil() throws IOException {
        int sign = 1;
        int c = br.read();
        int x = 0;
        if (c == '-') {
            sign = -1;
            c = br.read();
        }
        while (c >= '0' && c <= '9') {
            x = x * 10 + c - '0';
            c = br.read();
        }
        return ril(x);
    }

    long[] rkll() throws IOException {
        int sign = 1;
        int c = br.read();
        int x = 0;
        if (c == '-') {
            sign = -1;
            c = br.read();
        }
        while (c >= '0' && c <= '9') {
            x = x * 10 + c - '0';
            c = br.read();
        }
        return rll(x);
    }

    char[] rs() throws IOException {
        return br.readLine().toCharArray();
    }

    void sort(int[] A) {
        Random r = new Random();
        for (int i = A.length-1; i > 0; i--) {
            int j = r.nextInt(i+1);
            int temp = A[i];
            A[i] = A[j];
            A[j] = temp;
        }
        Arrays.sort(A);
    }

    void printDouble(double d) {
        pw.printf("%.16f", d);
    }
}


import java.io.*;
import java.util.StringTokenizer;

public class C2 {
    String filename = null;
    InputReader sc;

    void solve() {
        int n = sc.nextInt();
        int[] a = sc.nextArray(n);

        int[] ps = new int[n];
        int[] q = new int[n];
        int[] qs = new int[n];
        int nq = 0;
        for (int i = 1; i < n; i++) {
            if (a[i] == 1) {
                qs[nq] = i - 1;
                q[nq++] = a[i - 1] + 1;
                ps[i] = i - 1;
            } else {
                if (a[i] == a[i - 1] + 1) {
                    qs[nq] = i - 1;
                    q[nq++] = 1;
                    ps[i] = i - 1;
                } else {
                    for (int j = nq - 1; j >= 0; j--) {
                        if (a[i] == q[j]) {
                            ps[i] = qs[j];
                            nq = j;
                            break;
                        }
                    }
                }
            }
        }

        int[] parents = ps;
        String[] strs = new String[n];
        strs[0] = "1";
        System.out.println(strs[0]);
        for (int i = 1; i < n; i++) {
            String p = strs[parents[i]];
            if (a[i] == 1) {
                strs[i] = p + ".1";
            } else {
                int lastDot = p.lastIndexOf(".");
                if (lastDot == -1) {
                    strs[i] = a[i] + "";
                } else {
                    strs[i] = p.substring(0, lastDot) + "." + a[i];
                }
            }
            System.out.println(strs[i]);
        }
    }

    public void run() throws FileNotFoundException {
        if (filename == null) {
            sc = new InputReader(System.in);
        } else {
            sc = new InputReader(new FileInputStream(new File(filename)));
        }

        int nTests = sc.nextInt();
        for (int test = 0; test < nTests; test++) {
            solve();
        }
    }

    public static void main(String[] args) {
        C2 sol = new C2();
        try {
            sol.run();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public float nextFloat() {
            return Float.parseFloat(next());
        }

        public double nextDouble() {
            return Float.parseFloat(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int[] nextArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }
    }
}


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

public class C{

	public static void main(String[] args) throws IOException {
		// br = new BufferedReader(new FileReader(".in"));
		// out = new PrintWriter(new FileWriter(".out"));
		//new Thread(null, new (), "peepee", 1<<28).start();
		read();
		int t= RI();
		while(t-->0) {
			read();
			int n = RI();
			List<Integer> cur = new ArrayList<Integer>();
			int[] lvl = new int[n+10];
			while(n-->0) {
				read();
				int x = RI();

				if (cur.size() == 0) {
					cur.add(x);
					lvl[cur.size()]=x;
				}
				else {
					while (!cur.isEmpty()) {
						if (x == 1+lvl[cur.size()]) {
							int size = cur.size();
							cur.remove(size-1);
							cur.add(1+lvl[size]);
							lvl[size] = x;
							break;
						}
						else {
							// Either add to a new level or go to existing one.
							if (x == 1) {
								// add
								cur.add(x);
								lvl[cur.size()] = x;
								break;
							}
							else {
								lvl[cur.size()] = 0;
								cur.remove(cur.size()-1);
							}
						}
					}
					if (cur.size() == 0) {
						cur.add(x);
						lvl[cur.size()]=x;
					}
				}

				for (int i = 0; i < cur.size(); i++) {
					out.print(cur.get(i));
					if (i != cur.size()-1) out.print(".");
				}
				out.println();
			}
		}
		out.close();
	}

	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	static StringTokenizer st;
	static void read() throws IOException{st = new StringTokenizer(br.readLine());}
	static int RI() throws IOException{return Integer.parseInt(st.nextToken());}
	static long RL() throws IOException{return Long.parseLong(st.nextToken());}
	static double RD() throws IOException{return Double.parseDouble(st.nextToken());}

}


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

import java.math.*;
import java.awt.Point;

public class Main {
    static final long MOD = 1000000007L;
    //static final long MOD2 = 1000000009L;
    //static final long MOD = 998244353L;
    //static final long INF = 500000000000L;
    static final int INF =   1000000005;
    static final int NINF = -1000000005;
    //static final long INF = 1000000000000000000L;
    static FastScanner sc;
    static PrintWriter pw;
    static final int[][] dirs = {{-1,0},{1,0},{0,-1},{0,1}};

    public static void main(String[] args) {
        sc = new FastScanner();
        pw = new PrintWriter(System.out);

        int Q = sc.ni();
        for (int q = 0; q < Q; q++) {
            int N = sc.ni();
            int[] nums = sc.intArray(N, 0);
            pw.println(1);
            ArrayDeque<Integer> ad = new ArrayDeque<Integer>();
            ad.push(1);
            for (int i = 1; i < N; i++) {
                if (nums[i]==1) {
                    ad.push(1);
                } else {
                    while (!ad.isEmpty()) {
                        int d = ad.pop();
                        if (d==nums[i]-1) {
                            ad.push(nums[i]);
                            break;
                        }
                    }
                }
                printAD(ad);
            }
        }

        pw.close();
    }

    public static void printAD(ArrayDeque<Integer> v) {
        Object[] arr = v.toArray();
        for (int i = arr.length-1; i >= 0; i--) {
            pw.print(arr[i]);
            if (i>0) pw.print(".");
        }
        pw.println();
    }

    public static void sort(int[] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            int temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr);
    }

    public static void sort(long[] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            long temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr);
    }

    //Sort an array (immune to quicksort TLE)
    public static void sort(int[][] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            int[] temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr, new Comparator<int[]>() {
            @Override
            public int compare(int[] a, int[] b) {
                return a[0]-b[0];
            }
        });
    }

    public static void sort(long[][] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            long[] temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr, new Comparator<long[]>() {
            @Override
            public int compare(long[] a, long[] b) {
                if (a[0] > b[0])
                    return 1;
                else if (a[0] < b[0])
                    return -1;
                else
                    return 0;
                //Ascending order.
            }
        });
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in), 32768);
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int ni() {
            return Integer.parseInt(next());
        }

        int[][] graph(int N, int[][] edges) {
            int[][] graph = new int[N][];
            int[] sz = new int[N];
            for (int[] e: edges) {
                sz[e[0]] += 1;
                sz[e[1]] += 1;
            }
            for (int i = 0; i < N; i++) {
                graph[i] = new int[sz[i]];
            }
            int[] cur = new int[N];
            for (int[] e: edges) {
                graph[e[0]][cur[e[0]]] = e[1];
                graph[e[1]][cur[e[1]]] = e[0];
                cur[e[0]] += 1;
                cur[e[1]] += 1;
            }
            return graph;
        }

        int[] intArray(int N, int mod) {
            int[] ret = new int[N];
            for (int i = 0; i < N; i++)
                ret[i] = ni()+mod;
            return ret;
        }

        char[] charArray(int N) {
            char[] ret = new char[N];
            for (int i = 0; i < N; i++)
                ret[i] = next().charAt(0);
            return ret;
        }

        long nl() {
            return Long.parseLong(next());
        }

        long[] longArray(int N, long mod) {
            long[] ret = new long[N];
            for (int i = 0; i < N; i++)
                ret[i] = nl()+mod;
            return ret;
        }

        double nd() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import javafx.util.Pair;

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

public class C {
    static HashMap<Integer, ArrayList<Integer>> tree = new HashMap<>();
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintStream out = System.out;

        int t = Integer.parseInt(br.readLine());

        for (int i = 0; i < t; i++) {
            int n = Integer.parseInt(br.readLine());
            ArrayList<Integer> depth = new ArrayList<>();
            int y = 0;
            String[] ans = new String[n];
            for (int x = 0; x < n; x++) {
                int in = Integer.parseInt(br.readLine());
                if (in == 1) {
                    if (y == depth.size()) depth.add(1);
                    else depth.set(y, 1);
                    y++;
                    StringBuilder curr = new StringBuilder();
                    curr.append(depth.get(0));
                    for (int a = 1; a < y; a++) {
                        curr.append('.');
                        curr.append(depth.get(a));
                    }
                    ans[x] = curr.toString();
                    continue;
                }
                for (int d = y-1; d >= 0; d--) {
                    if (depth.get(d) == in-1) {
                        y = d+1;
                        depth.set(d, depth.get(d)+1);
                        StringBuilder curr = new StringBuilder();
                        for (int a = 0; a < d; a++) {
                            curr.append(depth.get(a));
                            curr.append('.');
                        }
                        curr.append(in);
                        ans[x] = curr.toString();
                        break;
                    }
                }
            }
            //Arrays.sort(ans);
            for (String x : ans) out.println(x);
        }

        System.out.flush();
    }
}


import java.util.*;
import java.io.*;
public class EdF {
	static long[] mods = {1000000007, 998244353, 1000000009};
	static long mod = mods[0];
	public static MyScanner sc;
    public static PrintWriter out;
	public static void main(String[] havish) throws Exception{
		// TODO Auto-generated method stub
 		sc = new MyScanner();
 		out = new PrintWriter(System.out);
 		int t = sc.nextInt();
 		while(t-->0) {
 	 		int n = sc.nextInt();

 	 		Stack<Integer> st = new Stack<>();
 	 		Stack<Integer> temporary = new Stack<>();
 	 		for(int j = 0;j<n;j++){
 	 			int val = sc.nextInt();
 	 			boolean found = false;
 	 			while(!st.isEmpty()){
 	 				int temp = st.peek();
 	 				if (val == temp+1){
 	 					found = true;
 	 					st.pop();
 	 					break;
 	 				}
 	 				else{
 	 					temporary.add(st.pop());
 	 				}
 	 			}
 	 			if (!found){
	 	 			while(!temporary.isEmpty()){
	 	 				st.add(temporary.pop());
	 	 			}
 	 			}
 	 			st.add(val);
 	 			ArrayList<Integer> arr = new ArrayList<>();

 	 			for(int s : st){
 	 				arr.add(s);
 	 			}
 	 			for (int s =0 ;s<arr.size()-1;s++){
 	 				out.print(arr.get(s));
 	 				out.print(".");
 	 			}
 	 			out.println(arr.get(arr.size()-1));
 	 			temporary.clear();
 	 		}

 		}

 		out.close();

 	}

	public static void sort(int[] array){
		ArrayList<Integer> copy = new ArrayList<>();
		for (int i : array)
			copy.add(i);
		Collections.sort(copy);
		for(int i = 0;i<array.length;i++)
			array[i] = copy.get(i);
	}
	static String[] readArrayString(int n){
		String[] array = new String[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.next();
		return array;
	}
	static int[] readArrayInt(int n){
    	int[] array = new int[n];
    	for(int j = 0;j<n;j++)
    		array[j] = sc.nextInt();
    	return array;
    }
	static int[] readArrayInt1(int n){
		int[] array = new int[n+1];
		for(int j = 1;j<=n;j++){
			array[j] = sc.nextInt();
		}
		return array;
	}
	static long[] readArrayLong(int n){
		long[] array = new long[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.nextLong();
		return array;
	}
	static double[] readArrayDouble(int n){
		double[] array = new double[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.nextDouble();
		return array;
	}
	static int minIndex(int[] array){
		int minValue = Integer.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static int minIndex(long[] array){
		long minValue = Long.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static int minIndex(double[] array){
		double minValue = Double.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static long power(long x, long y){
		if (y == 0)
			return 1;
		if (y%2 == 1)
			return (x*power(x, y-1))%mod;
		return power((x*x)%mod, y/2)%mod;
	}
	static void verdict(boolean a){
        out.println(a ? "YES" : "NO");
    }
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}

//StringJoiner sj = new StringJoiner(" ");
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is


//Implemented By Aman Kotiyal Date:-30-May-2021  Time:-7:54:28 pm
import java.io.*;
import java.util.*;

public class ques3
{
	public static void main(String[] args)throws Exception{ new ques3().run();}
	long mod=1000000000+7;

	void solve() throws Exception
	{
		for(int ii=ni();ii>0;ii--)
		{
			int n=ni();
			//ArrayList<Integer> al=new ArrayList<Integer>();
			Stack<Integer> st=new Stack<Integer>();
			int x=ni();
			//al.add(1);
			st.add(1);
			out.println("1");
			for(int i=2;i<=n;i++)
			{
				 x=ni();
				 if(x==1)
				 {
					 st.add(1);
					 Stack<Integer> tep=(Stack<Integer>) st.clone();
					 display(tep);
					 continue;
				 }
				 int top=st.peek();
				 if(top+1==x)
				 {
					 st.pop();
					 st.add(x);
					 Stack<Integer> tep=(Stack<Integer>) st.clone();
					 display(tep);
					 continue;
				 }
				 while(true)
				 {
					 top=st.peek();
					 if(top+1==x)
					 {
						 st.pop();
						 st.add(x);
						 Stack<Integer> tep=(Stack<Integer>) st.clone();
						 display(tep);
						 break;
					 }
					 top=st.pop();
				 }
			}
		}
	}

	void display(Stack<Integer> st)
	{
		ArrayList<Integer> al = new ArrayList<>();
		while(st.size()!=0)
		{
			int tem=st.pop();
			al.add(tem);
		}
		Collections.reverse(al);
		for (int i = 0; i <al.size()-1; i++) {
			out.print(al.get(i)+".");
		}
		out.println(al.get(al.size()-1));
	}

	/*FAST INPUT OUTPUT & METHODS BELOW*/

	private byte[] buf=new byte[1024];
	private int index;
	private InputStream in;
	private int total;
	private SpaceCharFilter filter;
	PrintWriter out;

	int min(int... ar){int min=Integer.MAX_VALUE;for(int i:ar)min=Math.min(min, i);return min;}
	long min(long... ar){long min=Long.MAX_VALUE;for(long i:ar)min=Math.min(min, i);return min;}
	int max(int... ar) {int max=Integer.MIN_VALUE;for(int i:ar)max=Math.max(max, i);return max;}
	long max(long... ar) {long max=Long.MIN_VALUE;for(long i:ar)max=Math.max(max, i);return max;}
	void reverse(int a[]){for(int i=0;i<a.length>>1;i++){int tem=a[i];a[i]=a[a.length-1-i];a[a.length-1-i]=tem;}}
	void reverse(long a[]){for(int i=0;i<a.length>>1;i++){long tem=a[i];a[i]=a[a.length-1-i];a[a.length-1-i]=tem;}}
	String reverse(String s){StringBuilder sb=new StringBuilder(s);sb.reverse();return sb.toString();}

	void shuffle(int a[]) {
		ArrayList<Integer> al = new ArrayList<>();
		for(int i=0;i<a.length;i++)
			al.add(a[i]);

		Collections.sort(al);
		for(int i=0;i<a.length;i++)
			a[i]=al.get(i);
	}
	long lcm(long a,long b)
	{
		return (a*b)/(gcd(a,b));
	}

	int gcd(int a, int b)
	{
		if (a == 0)
			return b;
		return gcd(b%a, a);
	}
	long gcd(long a, long b)
	{
		if (a == 0)
			return b;
		return gcd(b%a, a);
	}
	/* for (1/a)%mod = ( a^(mod-2) )%mod  ----> use expo to calc -->(a^(mod-2)) */
	long expo(long p,long q)  /*  (p^q)%mod   */
	{
		long z = 1;
		while (q>0) {
			if (q%2 == 1) {
				z = (z * p)%mod;
			}
			p = (p*p)%mod;
			q >>= 1;
		}
		return z;
	}
	void run()throws Exception
	{
		in=System.in; out = new PrintWriter(System.out);
		solve();
		out.flush();
	}
	private int scan()throws IOException
	{
		if(total<0)
			throw new InputMismatchException();
		if(index>=total)
		{
			index=0;
			total=in.read(buf);
			if(total<=0)
				return -1;
		}
		return buf[index++];
	}
	private int ni() throws IOException
	{
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = scan();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = scan();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	private long nl() throws IOException
	{
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = scan()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = scan();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = scan();
		}
	}
	private double nd() throws IOException{
		return Double.parseDouble(ns());
	}
	private String ns() throws IOException {
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		StringBuilder res = new StringBuilder();
		do {
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);
			c = scan();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	private String nss() throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		return br.readLine();
	}
	private char nc() throws IOException
	{
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		return (char) c;
	}
	private boolean isWhiteSpace(int n)
	{
		if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
			return true;
		return false;
	}
	private boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhiteSpace(c);
	}
	private interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


/*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
 */
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;

public class x1523C
{
    public static void main(String hi[]) throws Exception
    {
        BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(infile.readLine());
        int T = Integer.parseInt(st.nextToken());
        StringBuilder sb = new StringBuilder();
        while(T-->0)
        {
            st = new StringTokenizer(infile.readLine());
            int N = Integer.parseInt(st.nextToken());
            int[] arr = new int[N];
            for(int i=0; i < N; i++)
                arr[i] = Integer.parseInt(infile.readLine());
            ArrayList<Integer>[] buckets = new ArrayList[N];
            buckets[0] = new ArrayList<Integer>();
            buckets[0].add(arr[0]);
            //first element always 1?
            for(int i=1; i < N; i++)
            {
                ArrayList<Integer> ls = new ArrayList<Integer>();
                if(arr[i] == 1)
                {
                    for(int x: buckets[i-1])
                        ls.add(x);
                    ls.add(1);
                }
                else
                {
                    int dex = -1;
                    for(int a=0; a < buckets[i-1].size(); a++)
                        if(buckets[i-1].get(a) == arr[i]-1)
                            dex = a;
                    for(int a=0; a < dex; a++)
                        ls.add(buckets[i-1].get(a));
                    ls.add(arr[i]);
                }
                buckets[i] = ls;
            }
            //output answer
            for(int a=0; a < N; a++)
            {
                for(int i=0; i < buckets[a].size()-1; i++)
                {
                    sb.append(buckets[a].get(i));
                    sb.append(".");
                }
                sb.append(arr[a]);
                sb.append("\n");
            }
        }
        System.out.print(sb);
    }
}


import java.util.Scanner;

public class C_1523 {

	static Scanner input = new Scanner(System.in);
	static int n;

	public static void main(String[] args) {
		int t = input.nextInt();
		for(int test = 0; test < t; test++){
			n = input.nextInt();
			int num = input.nextInt();
			if(num == 1){
				n--;
				recur("");
			}else{
				System.out.println("ERROR");
			}
		}
	}

	public static int recur(String before){
		int num = 1;
		System.out.println(before + num);
		while(n > 0){
			int val = input.nextInt();
			n--;
			if(val == 1){
				val = recur(before + num + ".");
			}
			if(val == num + 1){
				num++;
				System.out.println(before + num);
			}else{
				return val;
			}
		}
		return -1;
	}

}


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

public class codeforces {
	public static void main(String[] args) throws Exception {

		int t=sc.nextInt();
		while(t-->0) {
			int n=sc.nextInt();
			int[]a=sc.nextIntArray(n);
			LinkedList<Integer>ll=new LinkedList<Integer>();
			for(int i=0;i<n;i++) {
				if(a[i]==1) {
					ll.addLast(a[i]);
				}else if(ll.isEmpty()) {
					ll.addLast(a[i]);

				}else {
					while(!(ll.getLast()==a[i]-1)) {
						ll.removeLast();
					}
					ll.removeLast();
					ll.addLast(a[i]);
				}
				int ii=0;
				for(int j:ll) {
					pw.print(j);
					if(ii!=ll.size()-1){
						pw.print('.');
					}
					ii++;
				}
				pw.println();
			}

		}

		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader r) {
			br = new BufferedReader(r);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public long[] nextlongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public Long[] nextLongArray(int n) throws IOException {
			Long[] a = new Long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] a = new Integer[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

	static class pair implements Comparable<pair> {
		long x;
		long y;

		public pair(long x, long y) {
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return x + " " + y;
		}

		public boolean equals(Object o) {
			if (o instanceof pair) {
				pair p = (pair) o;
				return p.x == x && p.y == y;
			}
			return false;
		}

		public int hashCode() {
			return new Long(x).hashCode() * 31 + new Long(y).hashCode();
		}

		public int compareTo(pair other) {
			if (this.x == other.x) {
				return Long.compare(this.y, other.y);
			}
			return Long.compare(this.x, other.x);
		}
	}

	static class tuble implements Comparable<tuble> {
		int x;
		int y;
		int z;

		public tuble(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		public String toString() {
			return x + " " + y + " " + z;
		}

		public int compareTo(tuble other) {
			if (this.x == other.x) {
				if (this.y == other.y) {
					return this.z - other.z;
				}
				return this.y - other.y;
			} else {
				return this.x - other.x;
			}
		}
	}

	static long mod = 1000000007;
	static Random rn = new Random();
	static Scanner sc = new Scanner(System.in);
	static PrintWriter pw = new PrintWriter(System.out);
}


import java.io.*;
import java.util.*;
import java.math.*;

public class C {
	public static void main(String[] args) throws IOException {

		/**/
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		/*/
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream("src/c.in"))));
		/**/

		int t = sc.nextInt();
		for (int z = 0; z < t; ++z) {
			int n = sc.nextInt();
			ArrayList<Integer> al = new ArrayList<>();
			for (int i = 0; i < n; ++i) {
				int x = sc.nextInt();
				if (x==1) {
					al.add(x);
				} else {
					while (al.get(al.size()-1)!=x-1) {
						al.remove(al.size()-1);
					}
					al.remove(al.size()-1);
					al.add(x);
				}
				StringBuilder pr = new StringBuilder();
				String d = "";
				for (int xx : al) {
					pr.append(d+xx);
					d = ".";
				}
				System.out.println(pr);
			}
		}
	}
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.PI;
import static java.lang.System.in;
import static java.lang.System.out;
import static java.lang.System.err;
/*
11
1
1
1
2
2
1
2
1
2
2
3
*/
public class C {
    static public void main(String... args) throws Exception {
        Foster sc = new Foster();
        PrintWriter p = new PrintWriter(out);
        int t = sc.nextInt();
        while(t--!=0){
            int n = sc.nextInt();
            int a[] = sc.intArray(n);
            ArrayList<ArrayList<Integer>> arr = new ArrayList<>();
            for(int i = 0; i < n; i++){
                ArrayList<Integer> temp = new ArrayList<>();
                if(i-1 < 0){
                    temp.add(1);
                }
                else{
                    ArrayList<Integer> inner = arr.get(i-1);
                    int last = inner.get(inner.size()-1);
                    ArrayDeque<Integer> q = new ArrayDeque<>();
                    for(int j : inner){
                        q.addLast(j);
                    }
                    // if current is one greater then increment
                    if(last+1 == a[i]){
                        q.pollLast();
                        q.addLast(a[i]);
                    }
                    // move the chain
                    else if(a[i]==1){
                        q.addLast(a[i]);
                    }
                    // move back
                    else{
                        while(!q.isEmpty() && a[i]-q.peekLast() != 1){
                            q.pollLast();
                        }
                        if(q.isEmpty()) q.addLast(a[i]);
                        else{
                            q.pollLast();
                            q.addLast(a[i]);
                        }
                    }
                    // transfer queue to list
                    while(!q.isEmpty()){
                        temp.add(q.pollFirst());
                    }
                }
                arr.add(temp);
            }

            // output answer
            for(int i = 0; i < arr.size(); i++){
                p.print(arr.get(i).get(0));
                for(int j = 1; j < arr.get(i).size(); j++){
                    p.print("." + arr.get(i).get(j));
                }
                p.println();
            }
        }
        p.close();
    }

    static long[] sort(long a[]){
        ArrayList<Long> arr = new ArrayList<>();
        for(long i : a){
            arr.add(i);
        }
        Collections.sort(arr);
        for(int i = 0; i < arr.size(); i++){
            a[i] = arr.get(i);
        }
        return a;
    }
    static int[] sort(int a[]){
        ArrayList<Integer> arr = new ArrayList<>();
        for(int i : a){
            arr.add(i);
        }
        Collections.sort(arr);
        // Collections.reverse(arr);
        for(int i = 0; i < arr.size(); i++){
            a[i] = arr.get(i);
        }
        return a;
    }

/*
*/
/*
1. Check overflow in pow function or in general
2. Check indices of read array function
3. Think of an easier solution because the problems you solve are always easy
4. Check iterator of loop
5. If still doesn't work, then jump from the 729th floor 'coz "beta tumse na ho paayega"

    Move to top!!
*/
    static class Foster {
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        StringTokenizer st = new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        int[] intArray(int n) {                   // Check indices
            int arr[] = new int[n];
            for(int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
        long[] longArray(int n) {                 // Check indices
            long arr[] = new long[n];
            for(int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
        int[] getBits(int n) {                   //in Reverse Order
            int a[] = new int[31];
            for(int i = 0; i < 31; i++) {
                if(((1<<i) & n) != 0)
                    a[i] = 1;
            }
            return a;
        }
        static long pow(long... a) {
            long mod = Long.MAX_VALUE;
            if(a.length == 3)   mod = a[2];
            long res = 1;
            while(a[1] > 0) {
                if((a[1] & 1) == 1)
                    res = (res * a[0]) % mod;
                a[1] /= 2;
                a[0] = (a[0] * a[0]) % mod;
            }
            return res;
        }
    }
}


import java.util.*;
import java.io.*;
public class Main {

      static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(
                new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    if (cnt != 0) {
                        break;
                    }
                    else {
                        continue;
                    }
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0,
                                 BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
     //System.out.println("YES");
//System.out.println("NO");

//int n=sc.nextInt();
//int a[]=new int[n];
//for(int i=0;i<n;i++)
//a[i]=sc.nextInt();

//int n=sc.nextInt();
//long a[]=new long[n];
//for(int i=0;i<n;i++)
//a[i]=sc.nextLong();

//System.out.println();

//String str=sc.next();
//long n=sc.nextLong();

    public static void main(String[] args) throws IOException{
        Scanner sc=new Scanner(System.in);
      //  Reader sc=new Reader();
        PrintWriter out=new PrintWriter(System.out);
        int t = sc.nextInt();
		while(t-->0) {
		    int n=sc.nextInt();
		     ArrayList<Integer> al[]=new ArrayList[n+1];

		    for(int i=0;i<=n;i++)
		    al[i]=new ArrayList<>();

		    al[0].add(1);

		    int y;
		    y=sc.nextInt();
		    boolean flag=true;
		    for(int i=1;i<=n-1;i++) {
		         int x=sc.nextInt();
		        int idx=al[i-1].size()-1;
		        if(x!=1) {
		            while(flag) {
		                int ans=x-1;
		                if(al[i-1].get(idx)==ans) {
		                    idx--;
		                   break;
		                }
		                idx--;
		            }
		        }
		        for(int j=0;j<=idx;j++) {
		            al[i].add(al[i-1].get(j));
		        }
		        al[i].add(x);
		    }

		    for(int i=0;i<=n-1;i++) {
		        out.print(al[i].get(0));
		        for(int j=1;j<=al[i].size()-1;j++) {
		            out.print("."+al[i].get(j));
		        }
		        out.println();
		    }

  }

		  out.flush();
		  out.close();

        }

}


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

public class C {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        int t = Integer.parseInt(f.readLine());
        while(t-->0){
            int n = Integer.parseInt(f.readLine());
            int[] arr = new int[n];
            for(int i = 0; i < n; i++){
                arr[i] = Integer.parseInt(f.readLine());
            }
            int[] levels = new int[n];
            int curr_level = 0;
            for(int i = 0; i < n; i++){
                if(levels[curr_level] == arr[i]-1){
                    levels[curr_level]++;
                }else if(arr[i] == 1){
                    curr_level++;
                    levels[curr_level]++;
                }else if(arr[i] > 1){
                    while(curr_level > 0 && levels[curr_level] != arr[i]-1){
                        levels[curr_level] = 0;
                        curr_level--;
                    }
                    levels[curr_level]++;
                }
                StringBuilder ostring = new StringBuilder();
                for(int level = 0; level <= curr_level; level++){
                    ostring.append(levels[level]);
                    if(level != curr_level) ostring.append(".");
                }
                out.println(ostring);
            }

        }
        out.close();
    }
}


//package deltix2021;
import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;

public class C {
	InputStream is;
	FastWriter out;
	String INPUT = "";

	void solve()
	{
		for(int T = ni();T > 0;T--)go();
	}

	void go()
	{
		int n = ni();
		int[] st = new int[n];
		int sp = 0;
		for(int i = 0;i < n;i++){
			int x = ni();
			if(x == 1){
				st[sp++] = 1;
			}else{
				while(sp > 0){
					if(st[sp-1] + 1 == x){
						st[sp-1]++;
						break;
					}else{
						sp--;
					}
				}
			}
			for(int j = 0;j < sp;j++){
				if(j > 0)out.print(".");
				out.print(st[j]);
			}
			out.println();
		}
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new FastWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new C().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private long[] nal(int n)
	{
		long[] a = new long[n];
		for(int i = 0;i < n;i++)a[i] = nl();
		return a;
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[][] nmi(int n, int m) {
		int[][] map = new int[n][];
		for(int i = 0;i < n;i++)map[i] = na(m);
		return map;
	}

	private int ni() { return (int)nl(); }

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	public static class FastWriter
	{
		private static final int BUF_SIZE = 1<<13;
		private final byte[] buf = new byte[BUF_SIZE];
		private final OutputStream out;
		private int ptr = 0;

		private FastWriter(){out = null;}

		public FastWriter(OutputStream os)
		{
			this.out = os;
		}

		public FastWriter(String path)
		{
			try {
				this.out = new FileOutputStream(path);
			} catch (FileNotFoundException e) {
				throw new RuntimeException("FastWriter");
			}
		}

		public FastWriter write(byte b)
		{
			buf[ptr++] = b;
			if(ptr == BUF_SIZE)innerflush();
			return this;
		}

		public FastWriter write(char c)
		{
			return write((byte)c);
		}

		public FastWriter write(char[] s)
		{
			for(char c : s){
				buf[ptr++] = (byte)c;
				if(ptr == BUF_SIZE)innerflush();
			}
			return this;
		}

		public FastWriter write(String s)
		{
			s.chars().forEach(c -> {
				buf[ptr++] = (byte)c;
				if(ptr == BUF_SIZE)innerflush();
			});
			return this;
		}

		private static int countDigits(int l) {
			if (l >= 1000000000) return 10;
			if (l >= 100000000) return 9;
			if (l >= 10000000) return 8;
			if (l >= 1000000) return 7;
			if (l >= 100000) return 6;
			if (l >= 10000) return 5;
			if (l >= 1000) return 4;
			if (l >= 100) return 3;
			if (l >= 10) return 2;
			return 1;
		}

		public FastWriter write(int x)
		{
			if(x == Integer.MIN_VALUE){
				return write((long)x);
			}
			if(ptr + 12 >= BUF_SIZE)innerflush();
			if(x < 0){
				write((byte)'-');
				x = -x;
			}
			int d = countDigits(x);
			for(int i = ptr + d - 1;i >= ptr;i--){
				buf[i] = (byte)('0'+x%10);
				x /= 10;
			}
			ptr += d;
			return this;
		}

		private static int countDigits(long l) {
			if (l >= 1000000000000000000L) return 19;
			if (l >= 100000000000000000L) return 18;
			if (l >= 10000000000000000L) return 17;
			if (l >= 1000000000000000L) return 16;
			if (l >= 100000000000000L) return 15;
			if (l >= 10000000000000L) return 14;
			if (l >= 1000000000000L) return 13;
			if (l >= 100000000000L) return 12;
			if (l >= 10000000000L) return 11;
			if (l >= 1000000000L) return 10;
			if (l >= 100000000L) return 9;
			if (l >= 10000000L) return 8;
			if (l >= 1000000L) return 7;
			if (l >= 100000L) return 6;
			if (l >= 10000L) return 5;
			if (l >= 1000L) return 4;
			if (l >= 100L) return 3;
			if (l >= 10L) return 2;
			return 1;
		}

		public FastWriter write(long x)
		{
			if(x == Long.MIN_VALUE){
				return write("" + x);
			}
			if(ptr + 21 >= BUF_SIZE)innerflush();
			if(x < 0){
				write((byte)'-');
				x = -x;
			}
			int d = countDigits(x);
			for(int i = ptr + d - 1;i >= ptr;i--){
				buf[i] = (byte)('0'+x%10);
				x /= 10;
			}
			ptr += d;
			return this;
		}

		public FastWriter write(double x, int precision)
		{
			if(x < 0){
				write('-');
				x = -x;
			}
			x += Math.pow(10, -precision)/2;
			//		if(x < 0){ x = 0; }
			write((long)x).write(".");
			x -= (long)x;
			for(int i = 0;i < precision;i++){
				x *= 10;
				write((char)('0'+(int)x));
				x -= (int)x;
			}
			return this;
		}

		public FastWriter writeln(char c){
			return write(c).writeln();
		}

		public FastWriter writeln(int x){
			return write(x).writeln();
		}

		public FastWriter writeln(long x){
			return write(x).writeln();
		}

		public FastWriter writeln(double x, int precision){
			return write(x, precision).writeln();
		}

		public FastWriter write(int... xs)
		{
			boolean first = true;
			for(int x : xs) {
				if (!first) write(' ');
				first = false;
				write(x);
			}
			return this;
		}

		public FastWriter write(long... xs)
		{
			boolean first = true;
			for(long x : xs) {
				if (!first) write(' ');
				first = false;
				write(x);
			}
			return this;
		}

		public FastWriter writeln()
		{
			return write((byte)'\n');
		}

		public FastWriter writeln(int... xs)
		{
			return write(xs).writeln();
		}

		public FastWriter writeln(long... xs)
		{
			return write(xs).writeln();
		}

		public FastWriter writeln(char[] line)
		{
			return write(line).writeln();
		}

		public FastWriter writeln(char[]... map)
		{
			for(char[] line : map)write(line).writeln();
			return this;
		}

		public FastWriter writeln(String s)
		{
			return write(s).writeln();
		}

		private void innerflush()
		{
			try {
				out.write(buf, 0, ptr);
				ptr = 0;
			} catch (IOException e) {
				throw new RuntimeException("innerflush");
			}
		}

		public void flush()
		{
			innerflush();
			try {
				out.flush();
			} catch (IOException e) {
				throw new RuntimeException("flush");
			}
		}

		public FastWriter print(byte b) { return write(b); }
		public FastWriter print(char c) { return write(c); }
		public FastWriter print(char[] s) { return write(s); }
		public FastWriter print(String s) { return write(s); }
		public FastWriter print(int x) { return write(x); }
		public FastWriter print(long x) { return write(x); }
		public FastWriter print(double x, int precision) { return write(x, precision); }
		public FastWriter println(char c){ return writeln(c); }
		public FastWriter println(int x){ return writeln(x); }
		public FastWriter println(long x){ return writeln(x); }
		public FastWriter println(double x, int precision){ return writeln(x, precision); }
		public FastWriter print(int... xs) { return write(xs); }
		public FastWriter print(long... xs) { return write(xs); }
		public FastWriter println(int... xs) { return writeln(xs); }
		public FastWriter println(long... xs) { return writeln(xs); }
		public FastWriter println(char[] line) { return writeln(line); }
		public FastWriter println(char[]... map) { return writeln(map); }
		public FastWriter println(String s) { return writeln(s); }
		public FastWriter println() { return writeln(); }
	}

	public void trnz(int... o)
	{
		for(int i = 0;i < o.length;i++)if(o[i] != 0)System.out.print(i+":"+o[i]+" ");
		System.out.println();
	}

	// print ids which are 1
	public void trt(long... o)
	{
		Queue<Integer> stands = new ArrayDeque<>();
		for(int i = 0;i < o.length;i++){
			for(long x = o[i];x != 0;x &= x-1)stands.add(i<<6|Long.numberOfTrailingZeros(x));
		}
		System.out.println(stands);
	}

	public void tf(boolean... r)
	{
		for(boolean x : r)System.out.print(x?'#':'.');
		System.out.println();
	}

	public void tf(boolean[]... b)
	{
		for(boolean[] r : b) {
			for(boolean x : r)System.out.print(x?'#':'.');
			System.out.println();
		}
		System.out.println();
	}

	public void tf(long[]... b)
	{
		if(INPUT.length() != 0) {
			for (long[] r : b) {
				for (long x : r) {
					for (int i = 0; i < 64; i++) {
						System.out.print(x << ~i < 0 ? '#' : '.');
					}
				}
				System.out.println();
			}
			System.out.println();
		}
	}

	public void tf(long... b)
	{
		if(INPUT.length() != 0) {
			for (long x : b) {
				for (int i = 0; i < 64; i++) {
					System.out.print(x << ~i < 0 ? '#' : '.');
				}
			}
			System.out.println();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


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

/**
 __                  __
 ( _)                ( _)
 / / \\              / /\_\_
 / /   \\            / / | \ \
 / /     \\          / /  |\ \ \
 /  /   ,  \ ,       / /   /|  \ \
 /  /    |\_ /|      / /   / \   \_\
 /  /  |\/ _ '_| \   / /   /   \    \\
 |  /   |/  0 \0\    / |    |    \    \\
 |    |\|      \_\_ /  /    |     \    \\
 |  | |/    \.\ o\o)  /      \     |    \\
 \    |     /\\`v-v  /        |    |     \\
 | \/    /_| \\_|  /         |    | \    \\
 | |    /__/_ `-` /   _____  |    |  \    \\
 \|    [__]  \_/  |_________  \   |   \    ()
 /    [___] (    \         \  |\ |   |   //
 |    [___]                  |\| \|   /  |/
 /|    [____]                  \  |/\ / / ||
 (  \   [____ /     ) _\      \  \    \| | ||
 \  \  [_____|    / /     __/    \   / / //
 |   \ [_____/   / /        \    |   \/ //
 |   /  '----|   /=\____   _/    |   / //
 __ /  /        |  /   ___/  _/\    \  | ||
 (/-(/-\)       /   \  (/\/\)/  |    /  | /
 (/\/\)           /   /   //
 _________/   /    /
 \____________/    (

 @author NTUDragons-Reborn
 */

public class C{
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{

        double eps= 0.00000001;
        static final int MAXN = 10000001;

        // stores smallest prime factor for every number
        static int spf[] = new int[MAXN];

        Map<Integer,Set<Integer>> dp= new HashMap<>();

        // Calculating SPF (Smallest Prime Factor) for every
        // number till MAXN.
        // Time Complexity : O(nloglogn)
        public void sieve()
        {
            spf[1] = 1;
            for (int i=2; i<MAXN; i++)

                // marking smallest prime factor for every
                // number to be itself.
                spf[i] = i;

            // separately marking spf for every even
            // number as 2
            for (int i=4; i<MAXN; i+=2)
                spf[i] = 2;

            for (int i=3; i*i<MAXN; i++)
            {
                // checking if i is prime
                if (spf[i] == i)
                {
                    // marking SPF for all numbers divisible by i
                    for (int j=i*i; j<MAXN; j+=i)

                        // marking spf[j] if it is not
                        // previously marked
                        if (spf[j]==j)
                            spf[j] = i;
                }
            }
        }

        // A O(log n) function returning primefactorization
        // by dividing by smallest prime factor at every step
        public Set<Integer> getFactorization(int x)
        {
            if(dp.containsKey(x)) return dp.get(x);
            Set<Integer> ret = new HashSet<>();
            while (x != 1)
            {
                if(spf[x]!=2) ret.add(spf[x]);
                x = x / spf[x];
            }
            dp.put(x,ret);
            return ret;
        }
        // function to find first index >= x
        public int lowerIndex(List<Integer> arr, int n, int x)
        {
            int l = 0, h = n - 1;
            while (l <= h)
            {
                int mid = (l + h) / 2;
                if (arr.get(mid) >= x)
                    h = mid - 1;
                else
                    l = mid + 1;
            }
            return l;
        }

        // function to find last index <= y
        public int upperIndex(List<Integer> arr, int n, int y)
        {
            int l = 0, h = n - 1;
            while (l <= h)
            {
                int mid = (l + h) / 2;
                if (arr.get(mid) <= y)
                    l = mid + 1;
                else
                    h = mid - 1;
            }
            return h;
        }

        // function to count elements within given range
        public int countInRange(List<Integer> arr, int n, int x, int y)
        {
            // initialize result
            int count = 0;
            count = upperIndex(arr, n, y) -
                    lowerIndex(arr, n, x) + 1;
            return count;
        }
        InputReader in;
        PrintWriter out;
        public void solve(InputReader in, PrintWriter out) {
            this.in=in;
            this.out=out;
            int t=in.nextInt();
            while(t-->0){
                int n= in.nextInt();
                int[] arr= new int[n];
                for(int i=0;i<n;i++) arr[i]= in.nextInt();
                int[] cur= new int[n];
                int idx=0;
                for(int num: arr){
                    if(idx<n && num==cur[idx]+1){
                        cur[idx]=num;
                        printRes(cur, idx);
                        idx++;
                    }
                    else{
                        for(int i=idx;i>=0;i--){
                            if(i<n && num!=cur[i]+1) cur[i]=0;
                            else{
                                cur[i]=num;
                                printRes(cur,i);
                                i++;
                                idx=i;
                                break;
                            }
                        }
                    }

                }
            }
        }

        public void printRes(int[] cur, int idx){
            for(int i=0;i<idx;i++) out.print(cur[i]+".");
            out.println(cur[idx]);
        }

        public boolean ok(char[] s){
            boolean allEqual = true;
            boolean Alternate = true;
            for (int i = 0; i < s.length - 1; i++){
                if (s[i]!=s[i+1]){
                    allEqual = false;
                }
                else{
                    Alternate = false;
                }
            }
            if (s[0] == '0' || s[s.length-1] == '0'){
                return false;
            }
            return allEqual || Alternate;
        }

        // private int cal()
        public static boolean nextPermutation(char[] array){
            boolean hasNext = false;
            int i;
            for(i = array.length-2; i >= 0; i--){
                if(array[i] < array[i+1]){
                    hasNext = true;
                    break;
                }
            }

            if(!hasNext){// If all elements are arranged from largest to smallest, it means the largest string
                return false;
            }

            // Find backward from the subscript of i + 1 (must be monotonically decreasing), find a smallest element in the set larger than array [i]
            int j;
            for(j = i+1; j < array.length; j++){
                if(array[j] <= array[i]){
                    break;
                }
            }
            j--;

            // Swap these two elements, and then reverse all the elements in i + 1 and later (i + 1, array.length)
            swap(array, i, j);
            reverse(array, i+1, array.length);

            return true;
        }
        public static void swap(char[] array, int i, int j) {
            char temp =array[i];
            array[i] = array[j];
            array[j] =temp;
        }
        public static void reverse(char[] array, int start, int end){
            for(int i = start, j = end-1; i < j; i++, j--) {
                swap(array, i, j);
            }
        }

        public static class compareL implements Comparator<Tuple>{
            @Override
            public int compare(Tuple t1, Tuple t2) {
                return t2.l - t1.l;
            }
        }
        public static class compareR implements Comparator<Tuple>{
            @Override
            public int compare(Tuple t1, Tuple t2) {
                return t1.r - t2.r;
            }
        }
        public static class Tuple{
            public int l, r, w;
            public Tuple(int l, int r,int w){
                this.l = l; this.r= r;
                this.w =w;
            }
        }
        public static class Range implements Comparable<Range>{
            public int l, r;
            List<Integer> data;
            int weight;
            public Range(int l, int r, List<Integer> data){
                this.data = data;
                this.l = l; this.r =r;
                this.weight = (int)1e9;
            }

            @Override
            public int compareTo(Range o) {
                return this.l - o.l;
            }
        }
        public int _gcd(int a,  int  b)
        {

            if(b == 0) {
                return a;
            }
            else {
                return _gcd(b, a % b);
            }
        }

    }

    static class Tuple implements Comparable<Tuple>{
        int x, y, z;
        public Tuple(int x, int y, int z){
            this.x= x;
            this.y= y;
            this.z=z;
        }
        @Override
        public int compareTo(Tuple o){
            return this.x-o.x;
        }
    }

    static class Pair implements Comparable<Pair>{
        public int x;
        public int y;
        public Pair(int x, int y){
            this.x= x;
            this.y= y;
        }

        @Override
        public int compareTo(Pair o) {
            return this.x-o.x;
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public double nextDouble(){
            return Double.parseDouble(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
}