source_code: 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);
      }
  }