import java.util.*;
import java.util.Map.Entry;

import java.io.*;
import java.math.*;
import static java.util.stream.Collectors.*;
import static java.util.Map.Entry.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws Exception
	{
		final long mod=(long) (1e9+7);
		final long mod1=(long) 998244353;
		Reader s=new Reader();
		  PrintWriter pt=new PrintWriter(System.out);

		  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		  int T=s.nextInt();
//		  int T=Integer.parseInt(br.readLine());
//		  int T=1;
		  while(T-->0)
		  {
			  int n=s.nextInt();
			  int arr[]=new int[n];
			  int brr[]=new int[n];
			  int e=-1;
			  for(int i=0;i<n;i++) {
				  arr[i]=s.nextInt();
				  if(e==-1) {
					  brr[e+1]=arr[i];
					  e++;
				  }
				  else {
					  if(arr[i]==1) {
						  e++;
						  brr[e]=arr[i];
					  }
					  else {
						  int j=e;
						  for(j=e;j>=0;j--) {
							  if((arr[i]-1)==brr[j])
								  break;
						  }
						  e=j;
						  brr[e]=arr[i];
					  }
				  }
				  pt.print(brr[0]);
				  for(int j=1;j<=e;j++) {
					  pt.print("."+brr[j]);
				  }
				  pt.println();
			  }

		  }

		  pt.close();
	}

	static boolean allOne(String str) {
		for(int i=0;i<str.length();i++) {
			if(str.charAt(i)=='0')
				return false;
		}
		return true;
	}

	static boolean isPartition(int arr[], int n) {
		int sum = 0;
	    int i, j;

	    // Calculate sum of all elements
	    for (i = 0; i < n; i++)
	        sum += arr[i];

	    if (sum % 2 != 0)
	        return false;

	    boolean part[][]=new boolean[sum/2+1][n+1];

	    // initialize top row as true
	    for (i = 0; i <= n; i++)
	        part[0][i] = true;

	    // initialize leftmost column, except part[0][0], as false
	    for (i = 1; i <= sum / 2; i++)
	        part[i][0] = false;

	    // Fill the partition table in bottom up manner
	    for (i = 1; i <= sum / 2; i++) {
	        for (j = 1; j <= n; j++) {
	            part[i][j] = part[i][j - 1];
	            if (i >= arr[j - 1])
	                part[i][j] = part[i][j]
	                             || part[i - arr[j - 1]][j - 1];
	        }
	    }
	    return part[sum / 2][n];
	}

	static int setBit(int S, int j) { return S | 1 << j; }

	static int clearBit(int S, int j) { return S & ~(1 << j); }

	static int toggleBit(int S, int j) { return S ^ 1 << j; }

	static boolean isOn(int S, int j) { return (S & 1 << j) != 0; }

	static int turnOnLastZero(int S) { return S | S + 1; }

	static int turnOnLastConsecutiveZeroes(int S) { return S | S - 1; }

	static int turnOffLastBit(int S) { return S & S - 1; }

	static int turnOffLastConsecutiveBits(int S) { return S & S + 1; }

	static int lowBit(int S) { return S & -S; }

	static int setAll(int N) { return (1 << N) - 1; }

	static int modulo(int S, int N) { return (S & N - 1); }		 //S%N, N is a power of 2

	static boolean isPowerOfTwo(int S) { return (S & S - 1) == 0; }

	static boolean isWithin(long x, long y, long d, long k) {
		return x*k*x*k + y*k*y*k <= d*d;
	}

	static long modFact(long n,
            long p)
	{
		if (n >= p)
		 return 0;

		long result = 1;
		for (int i = 1; i <= n; i++)
		 result = (result * i) % p;

		return result;
	}
	static int sum(int[] arr, int n)
	{
	    int inc[]=new int[n+1];
	    int dec[]=new int[n+1];
	    inc[0] = arr[0];
	    dec[0] = arr[0];

	    for (int i = 1; i < n; i++) {
	        for (int j = 0; j < i; j++) {
	            if (arr[j] > arr[i]) {
	                dec[i] = max(dec[i], inc[j] + arr[i]);
	            }
	            else if (arr[i] > arr[j]) {
	                inc[i] = max(inc[i], dec[j] + arr[i]);
	            }
	        }
	    }
	    return max(inc[n - 1], dec[n - 1]);
	}
	static long nc2(long a) {
		return a*(a-1)/2;
	}
	public static int numberOfprimeFactors(int n)
    {
        // Print the number of 2s that divide n
		HashSet<Integer> hs = new HashSet<Integer>();
        while (n%2==0)
        {
            hs.add(2);
            n /= 2;
        }

        // n must be odd at this point.  So we can
        // skip one element (Note i = i +2)
        for (int i = 3; i <= Math.sqrt(n); i+= 2)
        {
            // While i divides n, print i and divide n
            while (n%i == 0)
            {
                hs.add(i);
                n /= i;
            }
        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2
        if (n > 2)
            hs.add(n);
        return hs.size();
    }
	static long gcd(long a, long b)
    {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }

	static void reverse(int arr[],int start, int end)
	{
		int temp;

		while (start < end)
		{
		    temp = arr[start];
		    arr[start] = arr[end];
		    arr[end] = temp;
		    start++;
		    end--;
		}
	}
	static void reverse(long arr[],int start, int end)
	{
		long temp;

		while (start < end)
		{
		    temp = arr[start];
		    arr[start] = arr[end];
		    arr[end] = temp;
		    start++;
		    end--;
		}
	}
	static boolean isPrime(int n)
    {
        // Corner cases
        if (n <= 1) return false;
        if (n <= 3) return true;

        // This is checked so that we can skip
        // middle five numbers in below loop
        if (n % 2 == 0 || n % 3 == 0) return false;

        for (int i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
            return false;

        return true;
    }
	static int p2(int n) {
		int k=0;
		while(n>1) {
			if(n%2!=0)
				return k;
			n/=2;
			k++;
		}
		return k;
	}
	static boolean isp2(int n) {
		while(n>1) {
			if(n%2==1)
				return false;
			n/=2;
		}
		return true;
	}
	static int binarySearch(int arr[], int first, int last, int key){
		   int mid = (first + last)/2;
		   while( first <= last ){
		      if ( arr[mid] < key ){
		        first = mid + 1;
		      }else if ( arr[mid] == key ){
		        return mid;
		      }else{
		         last = mid - 1;
		      }
		      mid = (first + last)/2;
		   }
		   return -1;
		 }

	static void print(int a[][]) {
		for(int i=0;i<a.length;i++)
		{
			for(int j=0;j<a[0].length;j++)
				System.out.print(a[i][j]+" ");
			System.out.println();
		}
	}
	static int max (int x, int y) {
		return (x > y)? x : y;
	}
	static int search(Pair[] p, Pair pair) {
		int l=0, r=p.length;
		while (l <= r) {
	        int m = l + (r - l) / 2;
	        if (p[m].compareTo(pair)==0)
	            return m;
	        if (p[m].compareTo(pair)<0)
	            l = m + 1;
	        else
	            r = m - 1;
	    }
	    return -1;
	}
	static void pa(int a[])
	{
		for(int i=0;i<a.length;i++)
			System.out.print(a[i]+" ");
		System.out.println();

	}
	static void pa(long a[])
	{
		for(int i=0;i<a.length;i++)
			System.out.print(a[i]+" ");
		System.out.println();

	}
	static void reverseArray(int arr[],
            int start, int end)
	{
		int temp;

		while (start < end)
		{
		    temp = arr[start];
		    arr[start] = arr[end];
		    arr[end] = temp;
		    start++;
		    end--;
		}
	}
	static boolean isPalindrome(String s) {
		int l=s.length();
		for(int i=0;i<l/2;i++)
		{
			if(s.charAt(i)!=s.charAt(l-i-1))
				return false;
		}
		return true;
	}
	static long nc2(long n, long m) {
		return (n*(n-1)/2)%m;
	}
	static long c(long a) {
		return a*(a+1)/2;
	}
	static int next(long[] arr, long target)
    {
        int start = 0, end = arr.length - 1;

        int ans = -1;
        while (start <= end) {
            int mid = (start + end) / 2;

            // Move to right side if target is
            // greater.
            if (arr[mid] < target) {
                start = mid + 1;
            }

            // Move left side.
            else {
                ans = mid;
                end = mid - 1;
            }
        }
        return ans;
    }

	static int prev(long[] arr, long target)
    {
        int start = 0, end = arr.length - 1;

        int ans = -1;
        while (start <= end) {
            int mid = (start + end) / 2;

            // Move to left side if target is
            // lesser.
            if (arr[mid] > target) {
                end = mid - 1;
            }

            // Move right side.
            else {
                ans = mid;
                start = mid + 1;
            }
        }
        return ans;
    }

	static long power(long x, long y, long p)
    {
        long res = 1;
        x = x % p;

        while (y > 0)
        {
            if (y % 2 == 1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return  res;
    }
    static long modInverse(long n, long p)
    {
        return power(n, p-2, p);
    }
    static long nCrModP(long n, long r,
                                    long p)
    {
        if(r>n)
        	return 0;
    	if (r == 0)
            return 1;
        long[] fac = new long[(int) (n+1)];
        fac[0] = 1;
        for (int i = 1 ;i <= n; i++)
            fac[i] = fac[i-1] * i % p;
        return (fac[(int) n]* modInverse(fac[(int) r], p)
                % p * modInverse(fac[(int) (n-r)], p)
                                    % p) % p;
    }
	static String reverse(String str)
	{
		return new StringBuffer(str).reverse().toString();
	}

	static long fastpow(long x, long y, long m)
    {
        if (y == 0)
            return 1;

        long p = fastpow(x, y / 2, m) % m;
        p = (p * p) % m;

        if (y % 2 == 0)
            return p;
        else
            return (x * p) % m;
    }

	static boolean isPerfectSquare(long l)
	{
		return Math.pow((long)Math.sqrt(l),2)==l;
	}

	static void merge(long[] arr, int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
	static void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
    static class Pair implements Comparable<Pair>{
        int a;
        int b;
        Pair(int a,int b){
            this.a=a;

            this.b=b;
        }
        public int compareTo(Pair p){
            if(a>p.a)
                return 1;
            if(a==p.a)
                return (b-p.b);
            return -1;
        }
    }
	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[128]; // 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.util.*;
import java.io.*;

public class Deltix {
    static PrintWriter out;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            Stack<Integer> s = new Stack<>();
            int [] a = new int[n];
            for (int i = 0; i < n; ++i) a[i] = sc.nextInt();
            for (int i = 0; i < n; i++) {
                if (a[i] == 1) {
                    s.push(1);
                } else {
                    while (s.peek() != a[i] - 1) {
                        s.pop();
                    }
                    s.pop();
                    s.push(a[i]);
                }
                print(s);
            }
        }
        out.close();
    }

    static void print(Stack<Integer> s) {
        ArrayDeque<Integer> a = new ArrayDeque<>();
        while (!s.isEmpty()) {
            a.addFirst(s.pop());
        }
        while (!a.isEmpty()) {
            int x = a.pollFirst();
            out.print(x);
            s.push(x);
            if (a.size() != 0) out.print(".");
        }
        out.println();
    }

    static void sort(int[] a) {
        ArrayList<Integer> q = new ArrayList<>();
        for (int i : a) q.add(i);
        Collections.sort(q);
        for (int i = 0; i < a.length; i++) a[i] = q.get(i);
    }

    static void sort(long[] a) {
        ArrayList<Long> q = new ArrayList<>();
        for (long i : a) q.add(i);
        Collections.sort(q);
        for (int i = 0; i < a.length; i++) a[i] = q.get(i);
    }

    //-----------MyScanner class for faster input----------
    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;
        }

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main{
    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();
        }

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

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
    static class FastWriter extends PrintWriter {
        FastWriter(){
            super(System.out);
        }
        void println(int[] array) {
            for(int i=0; i<array.length; i++) {
                print(array[i]+" ");
            }
            println();
        }
        void println(long [] array) {
            for(int i=0; i<array.length; i++) {
                print(array[i]+" ");
            }
            println();
        }
    }
    static class Interval {
        long start,end;
        Interval(long start, long end)
        {
            this.start=start;
            this.end=end;
        }
    }
    static int MOD=998244353;
    public static void main(String[] args){
        FastScanner in = new FastScanner();
        FastWriter out = new FastWriter();
        Scanner sc=new Scanner(System.in);
        int t=in.nextInt();
        //int t=1;
        while (t-->0){
            int n=in.nextInt();
            int[] ar=in.nextArray(n);
            int[] level=new int[1005];
            int j=1;
            level[1]=1;
            out.println(1);
            for (int i = 1; i < n; i++) {
                if(ar[i]==1) {
                    j++;
                    level[j] = 1;
                }else {
                    while (j>=1){
                        if(level[j]+1!=ar[i]){
                            j--;
                        }else {
                            break;
                        }
                    }
                    level[j]++;
                }
                for (int k = 1; k <= j; k++) {
                    if(k==j){
                        out.print(level[k]);
                    }else {
                        out.print(level[k]+".");
                    }
                }
                out.println();
            }
        }
        out.close();
    }
    static int highestPowerOf2(int n) {
        if (n < 1){ return 0; }
        int res = 1;
        for (int i = 0; i < 8 * Integer.BYTES; i++) {
            int curr = 1 << i;
            if (curr > n){ break; }
            res = curr;
        }
        return res;
    }
    static int reduceFraction(int x, int y) {
        int d= gcd(x, y);
        return x/d+y/d;
    }
    static boolean subset(int[] ar,int n,int sum){
        if(sum==0){
            return true;
        }
        if(n<0||sum<0){
            return false;
        }
        return subset(ar,n-1,sum)||subset(ar,n-1,sum-ar[n]);
    }
    static boolean isPrime(int n){
        if(n<=1) return false;
        for(int i = 2;i<=Math.sqrt(n);i++){
            if (n % i == 0) return false;
        }
        return true;
    }
    static int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }
    static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }
    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }
    static int lcm(int a, int b) {
        return (a * b) / gcd(a, b);
    }
    static boolean isPowerOfTwo(int n) {
        if(n==0||n==1){return false;}
        double v = Math.log(n) / Math.log(2);
        return ((int)(Math.ceil(v)) == (int)(Math.floor(v)));
    }
    static boolean isPerfectSquare(int x){
        if (x >= 0) {
            int sr = (int)Math.sqrt(x);
            return ((sr * sr) == x);
        }
        return false;
    }
    static int lower_bound(int[] arr, int x) {
        int low_limit = 0, high_limit = arr.length, mid = -1;
        while (low_limit < high_limit) {
            mid = (low_limit + high_limit) / 2;
            if (arr[mid] >= x){
                high_limit = mid;
            }else{
                low_limit = mid + 1;
            }
        }
        return low_limit;
    }
    static int upper_bound(int[] arr, int x) {
        int low_limit = 0, high_limit = arr.length, mid = -1;
        while (low_limit < high_limit) {
            mid = (low_limit + high_limit) / 2;
            if (arr[mid] > x){
                high_limit = mid;
            }else{
                low_limit = mid + 1;
            }
        }
        return low_limit;
    }
    static int binarySearch(int[] ar,int n,int num){
        int low=0,high=n-1;
        while (low<=high){
            int mid=(low+high)/2;
            if(ar[mid]==num){
                return mid;
            }else if(ar[mid]>num){
                high=mid-1;
            }else {
                low=mid+1;
            }
        }
        return -1;
    }
}


//make sure to make new file!
import java.io.*;
import java.util.*;

public class CDS2021{

   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);

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

      for(int q = 1; q <= t; q++){

         int n = Integer.parseInt(f.readLine());

         int[] array = new int[n];
         for(int k = 0; k < n; k++){
            array[k] = Integer.parseInt(f.readLine());
         }

         StringJoiner sj = new StringJoiner("\n");
         Stack<Entry> stack = new Stack<Entry>();

         //first element should be 1
         sj.add("1");
         stack.push(new Entry("1",1));

         for(int k = 1; k < n; k++){
            if(array[k] == 1){
               //add new depth
               String s = stack.peek().s + ".1";
               sj.add(s);
               stack.push(new Entry(s,1));
            } else {
               while(!stack.isEmpty() && stack.peek().last != array[k]-1){
                  stack.pop();
               }

               if(stack.isEmpty()) break;             //shouldn't happen

               String s = "";
               int index = stack.peek().s.lastIndexOf(".");
               if(index == -1) s = "" + array[k];
               else s = stack.peek().s.substring(0,index+1) + array[k];
               sj.add(s);
               stack.pop();
               stack.push(new Entry(s,array[k]));
            }
         }

         out.println(sj.toString());
      }

      out.close();
   }

   public static class Entry{
      String s;
      int last;
      public Entry(String a, int b){
         s = a;
         last = b;
      }
   }

}


import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0, t = sc.nextInt(); i < t; i++) {
            int n = sc.nextInt();
            LinkedList<Set<Integer>> stack = new LinkedList<>();
            for (int j = 0; j < n; j++) {
                printStack(stack);
                int val = sc.nextInt();
                if (val == 1) {
                    Set<Integer> branch = new HashSet<>();
                    branch.add(val);
                    stack.push(branch);
                    continue;
                }
                Set<Integer> branch = stack.peek();
                assert branch != null;
                while (branch.contains(val) || branch.stream().max(Integer::compareTo).get() + 1 != val) {
                    stack.pop();
                    branch = stack.peek();
                }
                branch.add(val);
            }
            printStack(stack);
        }
    }

    public static void printStack(LinkedList<Set<Integer>> stack) {
        if (stack.size() == 0) {
            return;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = stack.size() - 1; i >= 0; i--) {
            sb.append(stack.get(i).stream().max(Integer::compareTo).get()).append(".");
        }
        System.out.println(sb.substring(0, sb.length() - 1));
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
/*
1
4
1
1
2
3
 */
public class C {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		int T=fs.nextInt();
		PrintWriter out=new PrintWriter(System.out);
		for (int tt=0; tt<T; tt++) {
			int n=fs.nextInt();
			int[] a=fs.readArray(n);
			int[] stack=new int[n];
			int size=0;
			for (int i:a) {
				if (i==1) {
					stack[size++]=i;
				}
				else {
					while (stack[size-1]!=i-1) {
						size--;
					}
					size--;
					stack[size++]=i;
				}
				for (int j=0; j<size; j++) {
					out.print(stack[j]);
					if (j!=size-1) out.print('.');
				}
				out.println();
			}

//			int[] mapTo=new int[n];
//			Arrays.fill(mapTo, -1);
//			ArrayDeque<Integer>[] occsOf=new ArrayDeque[1001];
//			for (int i=0; i<occsOf.length; i++) occsOf[i]=new ArrayDeque<>();
//			int lastOne=-1;
//
//			for (int i=0; i<n; i++) {
//				if (a[i]==1) {
//					mapTo[i]=lastOne;
//					lastOne=i;
//				}
//			}
//			for (int value=2; value<occsOf.length; value++) {
//				for (int i:occsOf[value]) {
//					int mapsTo=occsOf[value-1].removeFirst();
//					mapTo[i]=mapsTo;
//				}
//			}
//			System.out.println(Arrays.toString(mapTo));
//			for (int i=0; i<n; i++) {
//				ArrayList<Integer> listBackwards=new ArrayList<>();
//				listBackwards.add(a[i]);
//				int at=i;
//				while (true) {
////					System.out.println("x");
//					if (mapTo[at]==-1) {
//						break;
//					}
//					if (a[mapTo[at]]!=a[at]-1) {
//						listBackwards.add(a[mapTo[at]]);
//					}
//					at=mapTo[at];
//				}
//				for (int j=listBackwards.size()-1; j>=0; j--) {
//					out.print(listBackwards.get(j));
//					if (j!=0) out.print('.');
//				}
//				out.println();
//			}
		}
		out.close();
	}

	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}

	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();
		}

		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());
		}
	}

}


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

public class c1523 implements Runnable{

    public static void main(String[] args) {
    	try{
            new Thread(null, new c1523(), "process", 1<<26).start();
        }
        catch(Exception e){
            System.out.println(e);
        }
    }
	public void run() {
		FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		//PrintWriter out = new PrintWriter("file.out");
		Task solver = new Task();
		int t = scan.nextInt();
		//int t = 1;
		for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
		out.close();
	}

	static class Task {
		static final int oo = Integer.MAX_VALUE;
		static final long OO = Long.MAX_VALUE;

		public void solve(int testNumber, FastReader sc, PrintWriter out) {
			int N = sc.nextInt();
			int[] arr = sc.readArray(N);

			Stack<Integer> cur = new Stack<>();
			StringBuilder sb = new StringBuilder("");
			for(int i = 0; i < N; i++) {
				if(arr[i] == 1) {
					cur.add(1);
				} else {
					while(cur.peek() != arr[i] - 1)
						cur.pop();
					cur.pop();
					cur.add(arr[i]);
				}

				for(int each: cur) {
					sb.append(each + ".");
				}
				sb.deleteCharAt(sb.length()-1);
				sb.append("\n");
			}

			out.println(sb);
		}

	}
	static long modInverse(long N, long MOD) {
		return binpow(N, MOD - 2, MOD);
	}
	static long modDivide(long a, long b, long MOD) {
		a %= MOD;
		return (binpow(b, MOD-2, MOD) * a) % MOD;
	}
	static long binpow(long a, long b, long m) {
		a %= m;
		long res = 1;
		while (b > 0) {
			if ((b & 1) == 1)
				res = res * a % m;
			a = a * a % m;
			b >>= 1;
		}
		return res;
	}
	static int[] reverse(int a[])
    {
        int[] b = new int[a.length];
        for (int i = 0, j = a.length; i < a.length; i++, j--) {
            b[j - 1] = a[i];
        }

        return b;
    }
	static long[] reverse(long a[])
    {
        long[] b = new long[a.length];
        for (int i = 0, j = a.length; i < a.length; i++, j--) {
            b[j - 1] = a[i];
        }

        return b;
    }

	static void shuffle(Object[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			Object temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static void shuffle(int[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}
	static void shuffle(long[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static class tup implements Comparable<tup>, Comparator<tup>{
		int a, b;
		tup(int a,int b){
			this.a=a;
			this.b=b;
		}
		public tup() {
		}
		@Override
		public int compareTo(tup o){
			return Integer.compare(b,o.b);
		}
		@Override
		public int compare(tup o1, tup o2) {
			return Integer.compare(o1.b, o2.b);
		}

		@Override
	    public int hashCode() {
			return Objects.hash(a, b);
	    }

	    @Override
	    public boolean equals(Object obj) {
	    	if (this == obj)
                return true;
	    	if (obj == null)
                return false;
	    	if (getClass() != obj.getClass())
                return false;
	    	tup other = (tup) obj;
	    	return a==other.a && b==other.b;
	    }

	    @Override
	    public String toString() {
	    	return a + " " + b;
	    }
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

		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;
		}

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

		long[] readLongArray(int size) {
			long[] a = new long[size];
			for(int i = 0; i < size; i++) {
				a[i] = nextLong();
			}
			return a;
		}
	}

	static void dbg(int[] arr) {
		System.out.println(Arrays.toString(arr));
	}
	static void dbg(long[] arr) {
		System.out.println(Arrays.toString(arr));
	}
	static void dbg(boolean[] arr) {
		System.out.println(Arrays.toString(arr));
	}

	static void dbg(Object... args) {
        for (Object arg : args)
            System.out.print(arg + " ");
        System.out.println();
    }
}


import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

public class C{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        long mod=1000000007l;
        int cases=sc.nextInt();

        while(cases>0)
        {
            cases--;
            Stack<Integer> stack=new Stack<>();

            int n=sc.nextInt();

            for(int j=0;j<n;j++)
            {
                int x=sc.nextInt();
                if(x==1)
                {
                    stack.add(1);
                }
                else
                {
                    int p=stack.pop();
                    if(p==x-1)
                    {
                        stack.add(x);
                    }
                    else {
                        while (p != x-1) {
                            p = stack.pop();
                        }

                        stack.add(x);

                    }

                }
                StringBuilder f=new StringBuilder();
                Stack<Integer> temp=new Stack<>();

                while(stack.isEmpty()==false)
                {
                    temp.add(stack.pop());
                }

                while(temp.isEmpty()==false)
                {
                    int z=temp.pop();
                    f.append(z+".");
                    stack.add(z);
                }

                System.out.println(f.substring(0,f.length()-1));

            }

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dauom
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CCompressionAndExpansion solver = new CCompressionAndExpansion();
    int testCount = Integer.parseInt(in.next());
    for (int i = 1; i <= testCount; i++)
      solver.solve(i, in, out);
    out.close();
  }

  static class CCompressionAndExpansion {
    public final void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt();

      ArrayList<ArrayList<Integer>> ans = new ArrayList<>();
      ArrayList<Integer> start = new ArrayList<>();
      start.add(in.nextInt());
      ans.add(start);
      out.println("1");
      for (int i = 1; i < n; i++) {
        ArrayList<Integer> lastList = ans.get(ans.size() - 1);
        ArrayList<Integer> curList = (ArrayList<Integer>) lastList.clone();
        ans.add(curList);

        int curLast = in.nextInt();
        for (int j = lastList.size() - 1; j >= 0; j--) {
          int last = lastList.get(j);
          if (curLast == 1) {
            curList.add(1);
            break;
          } else if (curLast == last + 1) {
            curList.set(j, curLast);
            break;
          } else {
            curList.remove(j);
          }
        }
        for (int j = 0; j < curList.size(); j++) {
          if (j > 0) out.print(".");
          out.print(curList.get(j));
        }
        out.println();
      }
    }

  }

  static final class InputReader {
    private final InputStream stream;
    private final byte[] buf = new byte[1 << 18];
    private int curChar;
    private int numChars;

    public InputReader() {
      this.stream = System.in;
    }

    public InputReader(final InputStream stream) {
      this.stream = stream;
    }

    private int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public final int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {
      }

      byte sgn = 1;
      if (c == 45) { // 45 == '-'
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) { // 48 == '0', 57 == '9'
        res *= 10;
        res += c - 48; // 48 == '0'
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    public final String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    }

    private static boolean isSpaceChar(final int c) {
      return c == 32 || c == 10 || c == 13 || c == 9
          || c == -1; // 32 == ' ', 10 == '\n', 13 == '\r', 9 == '\t'
    }

  }
}


import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.BigInteger;
public class Main{
    static InputReader sc;
    static PrintWriter pw;
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        sc = new InputReader(inputStream);
        pw = new PrintWriter(outputStream);
        solve();
        pw.close();
    }
    // static int L,R,top,bottom;
    // static int cnt,edge;
    // static long ans;
    static int time;
    // static boolean isIsland;
    static BigInteger min(BigInteger a, BigInteger b){
        if(a.compareTo(b)<0)
            return a;
        return b;
    }
    public static void solve(){
        int t=1;
        t=s(0);
        u:while(t-->0){
            int n=s(0);
            int []arr=new int [n];
            feedArr(arr);
            Stack<Pair> stk=new Stack<>();
            stk.push(new Pair("",1));
            pln(1);
            Pair pr;
            for(int i=1;i<n;i++){
                if(arr[i]==1){
                    pr=stk.peek();
                    stk.push(new Pair(pr.s+(pr.s.length()==0?"":".")+pr.i,1));
                    pln(stk.peek().s+"."+stk.peek().i);
                }
                else if(stk.peek().i==arr[i]-1){
                    pr=stk.pop();
                    pln(pr.s+(pr.s.length()==0?"":".")+arr[i]);
                    pr.i++;
                    stk.push(pr);
                }
                else{
                    stk.pop();
                    i--;
                }
            }
        }
    }
    static long fact(long p){
        long ans=1l;
        for(long i=2;i<=p;i++)
            ans*=i;
        return ans;
    }
    static int find(int j, List<Integer> B, List<Integer> A, int i){
        // System.out.println("Hi");
        int l=j,r=B.size()-1,m;
        while(l<=r){
            m=(r-l)/2+l;
            if(A.size()-i-1<=B.size()-m-1)
                l=m+1;
            else
                r=m-1;
        }
        // System.out.println("Bye");
        return r;
    }
    static int find2(List<Integer> B, int x){
        int l=0,r=B.size()-1,m;
        // System.out.println("Hi2");
        // System.out.println(j);
        while(l<=r){
            m=(r-l)/2+l;
            // System.out.println(m);
            if(B.get(m)-x<=0)
                l=m+1;
            else
                r=m-1;
        }
        // System.out.println("Bye2");
        return r;
    }
    static long nPr(long n, long r){
        long ans=1;
        for(long i=1;i<=r;i++)
            ans*=(n-i+1);
        return ans;
    }
    static long nCr(long n, long r){
        long ans=1;
        for(long i=1;i<=r;i++){
            ans*=(n-i+1);
            ans/=i;
        }
        return ans;
    }
    static void update_DAG(int cur,int val, int []graph, int n)
    {
        if(val>maxx[cur])
        {
            int x=graph[cur];
            if(x!=-1)
                update_DAG(x,val+1,graph,n);
            maxx[cur]=val;
            update(cur,val,n);
        }
    }
    static int []bit, maxx;
    static void update(int i,int val, int n)
    {
        while(i<=n)
        {
            bit[i]=Math.max(bit[i],val);
            i=i+(i&(-i));
        }
    }
    static int query(int i)
    {
        int ret=0;
        while(i>0)
        {
            ret=Math.max(ret,bit[i]);
            i=i-(i&(-i));
        }
        return ret;
    }
    public static int [][]dir=new int [][]{{1,0},{0,1},{-1,0},{0,-1}};
    public static int find(List<Integer> list, int x){
        int l=0,r=list.size()-1,m;
        while(l<=r){
            m=(r-l)/2+l;
            if(list.get(m)<=x)
                l=m+1;
            else
                r=m-1;
        }
        return r;
    }
    static class Node{
        int val;
        long cost;
        Node next;
        Node(int v,long c){
            val=v;
            next=null;
            cost=c;
        }
    }
    public static long sum(long n){
        long val=0l;
        while(n>0){
            val+=n%10;
            n/=10;
        }
        return val;
    }
    // static class Node{
    //     int left,right;
    //     Node prev,next;
    //     Node(int i, int v){
    //         left=i;
    //         right=v;
    //         prev=next=null;
    //     }
    //     void remove(){
    //         this.prev.next=this.next;
    //         this.next.prev=this.prev;
    //     }
    //     void insert(Node node){
    //         node.next=this;
    //         node.prev=this.prev;
    //         node.prev.next=node;
    //         this.prev=node;
    //     }
    // }
    public static int  findDiameter(int r, List<List<Integer>>list){
        return findFarthest(findFarthest(r,list)[0],list)[1];
    }
    public static int[] findFarthest(int u, List<List<Integer>>list){
        int n=list.size();
        boolean []vis=new boolean[n+1];
        Queue<Integer>q=new LinkedList<>();
        q.offer(u);
        vis[u]=true;
        int s,pr,cnt=0;
        int []ar=new int[]{u,0};
        while(q.size()>0){
            s=q.size();
            while(s-->0){
                pr=q.poll();
                if(ar[1]<cnt){
                    ar[1]=cnt;
                    ar[0]=pr;
                }
                for(int i:list.get(pr)){
                    if(!vis[i]){
                        vis[i]=true;
                        q.offer(i);
                    }
                }
            }
            cnt++;
        }
        return ar;
    }
    public static long atMostK(char []chrr, int k){
        if(k<0)
            return 0;
        int l=0,cnt=0;
        long ans=0l;
        for(int i=0;i<chrr.length;i++){
            if(chrr[i]=='1')
                cnt++;
            while(cnt>k){
                if(chrr[l++]=='1')
                    cnt--;
            }
            ans+=(long)(i-l)+1l;
        }
        return ans;
    }
    public static int ask(int l, int r){
        System.out.println("? "+l+" "+r);
        System.out.flush();
        return sc.nextInt();
    }
    public static void sort(int []arr){
        ArrayList<Integer> list=new ArrayList<>();
        for(int i=0;i<arr.length;i++)
            list.add(arr[i]);
        Collections.sort(list);
        for(int i=0;i<arr.length;i++)
            arr[i]=list.get(i);
    }
    public static void sort(long []arr){
        ArrayList<Long> list=new ArrayList<>();
        for(int i=0;i<arr.length;i++)
            list.add(arr[i]);
        Collections.sort(list);
        for(int i=0;i<arr.length;i++)
            arr[i]=list.get(i);
    }
    public static void swap(char []chrr, int i, int j){
        char temp=chrr[i];
        chrr[i]=chrr[j];
        chrr[j]=temp;
    }
    public static int countSetBits(long n){
        int a=0;
        while(n>0){
            a+=(n&1);
            n>>=1;
        }
        return a;
    }
    static class Pair{
        String s;
        int i;
        Pair(String S, int I){
            s=S;
            i=I;
        }
     //*
    }
    /*/
        public int compareTo(Pair p){
            return (b-p.b);
        }
        public int hashCode(){
            int hashcode = (a+" "+b).hashCode();
            return hashcode;
        }
        public boolean equals(Object obj){
            if (obj instanceof Pair) {
                Pair p = (Pair) obj;
                return (p.a==this.a && p.b == this.b);
            }
            return false;
        }
    }
    //*/
    static boolean isPrime(long n) {
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;
        if (n % 2 == 0 || n % 3 == 0)
            return false;
        for (int i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;
        return true;
    }
    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return a>b?gcd(b, a % b):gcd(a, b % a);
    }
    static long fast_pow(long base,long n,long M){
        if(n==0)
           return 1;
        if(n==1)
        return base;
        long halfn=fast_pow(base,n/2,M);
        if(n%2==0)
            return ( halfn * halfn ) % M;
        else
            return ( ( ( halfn * halfn ) % M ) * base ) % M;
    }
    static long modInverse(long n,long M){
        return fast_pow(n,M-2,M);
    }
    public static int s(int n){
        return sc.nextInt();
    }
    public static long s(long n){
        return sc.nextLong();
    }
    public static String s(String n){
        return sc.next();
    }
    public static double s(double n){
        return sc.nextDouble();
    }
    public static void p(int n){
        pw.print(n);
    }
    public static void p(long n){
        pw.print(n);
    }
    public static void p(String n){
        pw.print(n);
    }
    public static void p(double n){
        pw.print(n);
    }
    public static void pln(int n){
        pw.println(n);
    }
    public static void pln(long n){
        pw.println(n);
    }
    public static void pln(String n){
        pw.println(n);
    }
    public static void pln(double n){
        pw.println(n);
    }
    public static void feedArr(long []arr){
        for(int i=0;i<arr.length;i++)
            arr[i]=sc.nextLong();
    }
    public static void feedArr(double []arr){
        for(int i=0;i<arr.length;i++)
            arr[i]=sc.nextDouble();
    }
    public static void feedArr(int []arr){
        for(int i=0;i<arr.length;i++)
            arr[i]=sc.nextInt();
    }
    public static void feedArr(String []arr){
        for(int i=0;i<arr.length;i++)
            arr[i]=sc.next();
    }
    public static String printArr(int []arr){
        StringBuilder sbr=new StringBuilder();
        for(int i:arr)
            sbr.append(i+" ");
        return sbr.toString();
    }
    public  static String printArr(long []arr){
        StringBuilder sbr=new StringBuilder();
        for(long i:arr)
            sbr.append(i+" ");
        return sbr.toString();
    }
    public static String printArr(String []arr){
        StringBuilder sbr=new StringBuilder();
        for(String i:arr)
            sbr.append(i+" ");
        return sbr.toString();
    }
    public static String printArr(double []arr){
        StringBuilder sbr=new StringBuilder();
        for(double i:arr)
            sbr.append(i+" ");
        return sbr.toString();
    }
    static 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 long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}
class AncestorQuerier {
    int [][]dp;
    int N=200001;
    int M=22;
    int max;
    public void preCompute(int []par){
        for(int i=0;i<N;i++){
            if(i>=2&&i<par.length)
                dp[i][0]=par[i];
            else
                dp[i][0]=-1;
        }
        for(int j=1;j<M;j++){
            for(int i=0;i<N;i++){
                if(dp[i][j-1]!=-1)
                    dp[i][j]=dp[dp[i][j-1]][j-1];
            }
        }
    }
    public int getAncestor(int val, int k) {
        if(k<0||val>max)
            return -1;
        if(k==0)
            return val;
        int t=(1<<(M-1));
        for(int i=M-1;i>=0&&val!=-1;i--,t>>=1){
            if(t<=k){
                val=dp[val][i];
                k-=t;
            }
        }
        return val;
    }
}


import java.util.*;
public class CompressionAndExpansion {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        for (int t = 0; t < T; t++) {
            int N = in.nextInt();
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                int n = in.nextInt();
                if (n == 1) {
                    list.add(n);
                } else {
                    for (int j = list.size() - 1; j >= 0; j--) {
                        if (list.get(j) == n - 1) {
                            list.set(j, n);
                            break;
                        }
                        list.remove(j);
                    }
                }
                for (int j = 0; j < list.size(); j++) {
                    System.out.print(list.get(j) + (j == list.size() - 1 ? "\n" : "."));
                }
            }
        }
    }
}


// package contest;

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

public class teama {

    static int mod = 2_000_000_007;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        int T = Integer.parseInt(br.readLine());
        for (int t = 0; t < T; t++) {
            int N = Integer.parseInt(br.readLine());
            Stack<Integer> stack = new Stack();
            for (int i = 0; i < N; i++) {
                int a = Integer.parseInt(br.readLine());
                if (a != 1) {
                    while (stack.peek() + 1 != a) {
                        stack.pop();
                    }
                    stack.pop();
                }
                stack.push(a);

                boolean dummy = false;
                for (int j : stack) {
                    if (dummy) {
                        pw.print(".");
                    }
                    pw.print(j);
                    dummy = true;
                }
                pw.println();
            }
        }

        pw.close();
        br.close();
    }
}


//package Codeforces;

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

public class C {
    static class Node{
        StringBuilder sb = new StringBuilder();
        Stack<Integer> stk = new Stack<>();
    }
    public static void main(String[] args) throws IOException {
        Soumit sc = new Soumit();

        int t = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        while (t-->0){
            int n = sc.nextInt();
            int[] arr = sc.nextIntArray(n);

            Stack<Node> mainstk = new Stack<>();

            Node pnode = new Node();
            pnode.stk.push(1);
            pnode.sb.append("1");
            mainstk.push(pnode);
            sb.append(pnode.sb).append("\n");

            for(int i=1;i<n;i++){
                int val = arr[i];
                if(val==1){
                    Node node = new Node();
                    node.stk.push(1);
                    node.sb.append(mainstk.peek().sb).append(".1");
                    mainstk.push(node);
                    sb.append(node.sb).append("\n");
                }
                else {
                    while (true) {
                        Node node = mainstk.pop();
                        if (node.stk.peek()==val-1) {
                            node.stk.push(val);
                            if(mainstk.isEmpty()){
                                node.sb = new StringBuilder();
                                node.sb.append(val);
                                sb.append(val).append("\n");
                            }
                            else{
                                Node peeknode = mainstk.peek();
                                node.sb = new StringBuilder();
                                node.sb.append(peeknode.sb).append(".").append(val);
                                sb.append(peeknode.sb).append(".").append(val).append("\n");
                            }
                            mainstk.push(node);
                            break;
                        }
                    }
                }
            }
        }

        System.out.println(sb);

        sc.close();
    }

    static class Soumit {
        final private int BUFFER_SIZE = 1 << 18;
        final private DataInputStream din;
        final private byte[] buffer;
        private PrintWriter pw;
        private int bufferPointer, bytesRead;
        StringTokenizer st;

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

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

        public void streamOutput(String file) throws IOException {
            FileWriter fw = new FileWriter(file);
            BufferedWriter bw = new BufferedWriter(fw);
            pw = new PrintWriter(bw);
        }

        public void println(String a) {
            pw.println(a);
        }

        public void print(String a) {
            pw.print(a);
        }

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

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

        public void sort(int[] arr) {
            ArrayList<Integer> arlist = new ArrayList<>();
            for (int i : arr)
                arlist.add(i);

            Collections.sort(arlist);
            for (int i = 0; i < arr.length; i++)
                arr[i] = arlist.get(i);
        }

        public void sort(long[] arr) {
            ArrayList<Long> arlist = new ArrayList<>();
            for (long i : arr)
                arlist.add(i);

            Collections.sort(arlist);
            for (int i = 0; i < arr.length; i++)
                arr[i] = arlist.get(i);
        }

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

            return arr;
        }

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

            return arr;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextDouble();
            }

            return arr;
        }

        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;*/
            if (din != null) din.close();
            if (pw != null) pw.close();
        }
    }
}


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

public class uo{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int testcases = Integer.parseInt(st.nextToken());
		for(int lmn=0;lmn<testcases;lmn++){
			st = new StringTokenizer(br.readLine());
			int n = Integer.parseInt(st.nextToken());
			// int k = Integer.parseInt(st.nextToken());
			// st = new StringTokenizer(br.readLine());
			ArrayList<Integer> a = new ArrayList<>();
			for(int lmn1 = 0;lmn1<n;lmn1++){
				st = new StringTokenizer(br.readLine());
				int a1 = Integer.parseInt(st.nextToken());
				if(a.size()>0 && (a1==1)){
					// a.add(a1);
				}
				else if(a.size()>0){
					if(a.size()==1){
						a.remove(0);
					}
					else{
						int i = a.size()-1;
						while(a.size()>0 && i>=0 && a.get(i)+1 != a1){
							a.remove(i);
							i--;
						}
						a.remove(a.size()-1);
						// System.out.println(a+" "+i);

					}
				}
				// while(a.size()>0 && a.get(a.size()-1)+1<a1){
				// 	a.remove(a.size()-1);
				// }
				if(a.size()==0){
					a.add(a1);
				}
				else{
					a.add(a1);
				}
				if(a.size()==1){
					System.out.println(a.get(0));
				}
				else{
					for(int i=0;i<a.size()-1;i++){

						System.out.print(a.get(i)+".");
					}
					System.out.println(a.get(a.size()-1));
				}

			}
		}

	}
}


import java.util.*;
import java.util.Scanner;

public class Def {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int t = s.nextInt();
		while (t-->0) {

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

//			int deep = 0;
//			System.out.println(n+"     n");
			List<Integer> al = new ArrayList<>();
			al.add(1);
			System.out.println(1);
			for(int i=1; i<n;i++) {
				int len = al.size();
//				for (int d =0; d<len; d++) {
//					System.out.print(al.get(d)+" ");
//				}
//				System.out.println();
				if (arr[i] == 1) {
					for(int j=0; j<len; j++) {
						System.out.print(al.get(j)+".");
					}
					System.out.println(1);
					al.add(1);
				}else if (arr[i] == arr[i-1] && arr[i]==1) {

					for(int j=0; j<len; j++) {
						System.out.print(al.get(j)+".");
					}
					System.out.println(1);
					al.add(1);
				}else {
					for (int j=len-1; j>-1; j--) {
						if (al.get(j)+1 == arr[i]) {
							for(int k=0; k<j; k++) {
								System.out.print(al.get(k)+".");
							}
							System.out.println(arr[i]);
							al.set(j, al.get(j)+1);
							al.subList(j+1, len).clear();
							break;
						}
					}
				}
			}

		}
		s.close();

	}

}


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

public class Solution
{
    static class Reader {
		BufferedReader br;
		StringTokenizer st;

		public Reader() {
			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[] nextArr(int n)
		{
		    int a[]=new int[n];
		    for (int i=0;i<n;i++)a[i]=nextInt();
		    return a;
		}

		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;
		}

	}
    static class Ele implements Comparable<Ele>
    {
        public int x,y;
        Ele(int x1,int y1)
        {
            x=x1;y=y1;
        }
        public int compareTo(Ele ob) {
        if(ob.x!=x)return x-ob.x;
        return this.y-ob.y;
        }
        public String toString()
        {
        	return "["+x+","+y+"]";
        }
    }
	void disp(PrintWriter o,boolean b)
    {
        if (b) o.println("Yes");
        else o.println("No");
    }
    void disp(PrintWriter o,int ...a)
    {
        o.println(Arrays.toString(a));
    }
    void disp(PrintWriter o,long ...a)
    {
        o.println(Arrays.toString(a));
    }
    void func(PrintWriter o,ArrayList<Integer> a)
    {
        for (int i=0;i<a.size();i++)
        {
            if (i!=a.size()-1)
            o.print(a.get(i)+".");
            else o.println(a.get(i));
        }
    }
    int dp[][];

	public static void main(String[] args) throws IOException
	{
		Reader sc=new Reader();Solution G=new Solution();//MyMath mm=new MyMath();
		PrintWriter o = new PrintWriter(System.out);
		int t=1;t=sc.nextInt();
		int mod=(int)1e9+7;
		int x,x0,x1,x2;int y,y0,y1,y2;int s,s0,s1,s2;
		int n,m;int a[],b[],in[],in1[];
		long k,l;boolean v[],b1,b2;String ss;char c1[];
		//long l;long a[];
		ArrayList<ArrayList<Integer>> ll=new ArrayList<>();
		ArrayList<Integer> a1=new ArrayList<>();
		ArrayList<Integer> a2=new ArrayList<>();
		PriorityQueue<Integer> pq1=new PriorityQueue<>();
		PriorityQueue<Integer> pq2=new PriorityQueue<>(Collections.reverseOrder());
		ArrayDeque<Integer> dq=new ArrayDeque<>();
		TreeSet<Integer> h0=new TreeSet<>();
		TreeSet<Integer> h1=new TreeSet<>();
		TreeMap<Integer,Integer> h=new TreeMap<>();
		try{
		while (t-->0)
		{
		    n=sc.nextInt();a=sc.nextArr(n);b=new int[(int)1e4];
		    a1.add(a[0]);b[1]=a[0];
		    for (int i=1;i<n;i++)
		    {
		        G.func(o,a1);
		        x=a1.get(a1.size()-1);
		        if (a[i]==1)
		        {
		            a1.add(a[i]);
		            b[a1.size()]=a[i];
		        }
		        else if (a[i]==x+1)
		        {
		            a1.remove(a1.size()-1);
		            a1.add(a[i]);
		            b[a1.size()]=a[i];
		        }
		        else
		        {
		            while (a1.get(a1.size()-1)!=a[i]-1)
		            a1.remove(a1.size()-1);
		            a1.remove(a1.size()-1);
		            a1.add(a[i]);
		        }
		    }
		    G.func(o,a1);
		    //o.println();
		    //o.println(n);
		    //o.println();
		    //o.println();
		    //o.println(h);
		    //o.println(x2);
		    //o.println();
		    h0.clear();ll.clear();a1.clear();a2.clear();h1.clear();h.clear();pq1.clear();pq2.clear();
		}
		}
		catch (Throwable e)
		{
		    e.printStackTrace();
		}
		//o.println("HI");

        o.flush();
        o.close();
	}
}


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

public class Main{
    public static void pri(ArrayList<Integer> list)
    {
        int len=list.size();
        for(int i=0;i<len-1;++i)
            System.out.print(list.get(i)+".");
        System.out.println(list.get(len-1));
    }
    public static void main(String[] args) throws java.io.IOException {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-->0)
        {
            int n=sc.nextInt();
            int[] arr=new int[n];
            for(int i=0;i<n;++i)
            {
                arr[i]=sc.nextInt();
            }
            ArrayList<Integer> cur=new ArrayList<>();
            cur.add(1);
            System.out.println(1);
            for(int i=1;i<n;++i)
            {
                if(arr[i]==1)
                {
                    cur.add(1);
                    pri(cur);
                    continue;
                }
                int len=cur.size();
                while(cur.get(len-1)!=arr[i]-1)
                {
                    cur.remove(len-1);
                    len--;
                }
                cur.set(len-1,arr[i]);
                pri(cur);
                continue;
            }
        }
    }
}
// 1 0 1 1 0 0 1


/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
    /*static long power(long a,long b,long m)
    {
        if(b==0)
        return 1;
        if((b&1)==0)
        return power((a*a)%m,b/2,m);
        else
        return (a*power((a*a)%m,b/2,m))%m;
    }*/
    /*
    static int gcd(int a,int b)
    {
        if(b==0)
        return a;
        else
        return gcd(b,a%b);
    }
    */
    public static void main (String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(br.readLine());
        PrintWriter p=new PrintWriter(System.out);
        while(t-->0)
        {
            //StringTokenizer st=new StringTokenizer(br.readLine());
            int n=Integer.parseInt(br.readLine());
            String a[]=new String[n];
            for(int i=0;i<n;i++)
            {
                a[i]=br.readLine();
            }
            String pre="1";
            for(int i=1;i<n;i++)
            {
                if(a[i].equals("1"))
                {
                    a[i]=pre+".1";
                    pre=a[i];
                    continue;
                }
                int li=pre.lastIndexOf('.');
                while(li!=-1 && Integer.parseInt(pre.substring(li+1))+1!=Integer.parseInt(a[i]))
                {
                    pre=pre.substring(0,li);
                    li=pre.lastIndexOf('.');
                }
                //li=pre.lastIndexOf('.');
                if(li!=-1)
                a[i]=pre.substring(0,li+1)+a[i];
                pre=a[i];
            }
            for(int i=0;i<n;i++)
            {
                p.println(a[i]);
            }
            p.flush();
        }
	}
}


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

public class _1523_C {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int t = Integer.parseInt(in.readLine());
        while(t-- > 0) {
            int n = Integer.parseInt(in.readLine());
            int[] a = new int[n];
            for(int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.readLine());
            }
            boolean[][] used = new boolean[n][n + 1];
            boolean[] used2 = new boolean[n];
            String[][] res = new String[n][2];
            res[0][0] = "1";
            res[0][1] = "";
            for(int i = 1; i < n; i++) {
                if(a[i] == 1) {
                    for(int j = i - 1; j >= 0; j--) {
                        if(!used[j][a[i]] && !used2[j]) {
                            res[i][0] = res[j][0] + ".1";
                            res[i][1] = res[j][0];
                            used[j][a[i]] = true;
                            break;
                        }
                    }
                }else {
                    for(int j = i - 1; j >= 0; j--) {
                        if(!used[j][a[i]] && !used2[j] && a[j] == a[i] - 1) {
                            if(res[j][1].equals("")) {
                                res[i][0] = "" + a[i];
                            }else {
                                res[i][0] = res[j][1] + "." + a[i];
                            }
                            res[i][1] = res[j][1];
                            used[j][a[i]] = true;
                            break;
                        }
                        used2[j] = true;
                    }
                }
            }
            for(int i = 0; i < n; i++) {
                out.println(res[i][0]);
            }
        }
        in.close();
        out.close();
    }
}


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

public class TestClass {

    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();
        }
    }

    static final class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        private int read() throws IOException {
            if (curChar >= numChars) {
                curChar = 0;
                numChars = stream.read(buf);
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public final int readInt() throws IOException {
            return (int) readLong();
        }

        public final long readLong() throws IOException {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
                if (c == -1) throw new IOException();
            }
            boolean negative = false;
            if (c == '-') {
                negative = true;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return negative ? -res : res;
        }

        public final int[] readIntArray(int size) throws IOException {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = readInt();
            }
            return array;
        }

        public final long[] readLongArray(int size) throws IOException {
            long[] array = new long[size];
            for (int i = 0; i < size; i++) {
                array[i] = readLong();
            }
            return array;
        }

        public final String readString() throws IOException {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.append((char) c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }

    static long mulmod(long a, long b,
                       long mod) {
        long res = 0; // Initialize result
        a = a % mod;
        while (b > 0) {
            // If b is odd, add 'a' to result
            if (b % 2 == 1) {
                res = (res + a) % mod;
            }

            // Multiply 'a' with 2
            a = (a * 2) % mod;

            // Divide b by 2
            b /= 2;
        }

        // Return result
        return res % mod;
    }

    static long pow(long a, long b, long MOD) {
        long x = 1, y = a;
        while (b > 0) {
            if (b % 2 == 1) {
                x = (x * y);
                if (x > MOD) x %= MOD;
            }
            y = (y * y);
            if (y > MOD) y %= MOD;
            b /= 2;
        }
        return x;
    }

    static long[] f = new long[200001];

    static long InverseEuler(long n, long MOD) {
        return pow(n, MOD - 2, MOD);
    }

    static long C(int n, int r, long MOD) {

        return (f[n] * ((InverseEuler(f[r], MOD) * InverseEuler(f[n - r], MOD)) % MOD)) % MOD;
    }

    static int[] h = {0, 0, -1, 1};
    static int[] v = {1, -1, 0, 0};

    public static class Pair {
        public int a;

        public int b;

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Pair pair = (Pair) o;
            return a == pair.a &&
                    b == pair.b;
        }

        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }

        public Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }

    static class Pair2 {
        public long cost;
        int node;

        public Pair2(long cos, int node) {
            this.cost = cos;
            this.node = node;
        }
    }

    static long compute_hash(String s) {
        int p = 31;
        int m = 1000000007;
        long hash_value = 0;
        long p_pow = 1;
        for (int i = 0; i < s.length(); ++i) {
            char c = s.charAt(i);
            hash_value = (hash_value + (c - 'a' + 1) * p_pow) % m;
            p_pow = (p_pow * p) % m;
        }
        return hash_value;
    }

    public static class SegmentTree {
        long[][] tree;
        int n;

        public SegmentTree(int[] nodes) {
            tree = new long[nodes.length * 4][2];
            n = nodes.length;
            build(0, n - 1, 0, nodes);

        }

        private void build(int l, int r, int pos, int[] nodes) {
            if (l == r) {
                tree[pos][0] = nodes[l];
                tree[pos][1] = l;
                return;
            }
            int mid = (l + r) / 2;
            build(l, mid, 2 * pos + 1, nodes);
            build(mid + 1, r, 2 * pos + 2, nodes);
            if (tree[2 * pos + 1][0] > tree[2 * pos + 2][0]) {
                tree[pos][1] = tree[2 * pos + 1][1];
            } else {
                tree[pos][1] = tree[2 * pos + 2][1];
            }
            tree[pos][0] = Math.max(tree[2 * pos + 1][0], tree[2 * pos + 2][0]);
        }

        //        public void update(int pos, int val) {
        //            updateUtil(0, n - 1, 0, pos, val);
        //        }

        public long[] get(int l, int r) {
            return getUtil(0, n - 1, 0, l, r);
        }

        private long[] getUtil(int l, int r, int pos, int ql, int qr) {
            if (ql > r || qr < l) {
                return new long[]{-1, -1};
            }
            if (l >= ql && r <= qr) {
                return tree[pos];
            }

            int mid = (l + r) / 2;
            long[] left = getUtil(l, mid, 2 * pos + 1, ql, qr);
            long[] right = getUtil(mid + 1, r, 2 * pos + 2, ql, qr);
            long choice = right[1];
            if (left[0] > right[0]) choice = left[1];
            return new long[]{Math.max(left[0], right[0]), choice};

        }

        //        private void updateUtil(int l, int r, int pos, int i, int val) {
        //            if (i < l || i > r) {
        //                return;
        //            }
        //            if (l == r) {
        //                tree[pos] = val;
        //                return;
        //            }
        //            int mid = (l + r) / 2;
        //            updateUtil(l, mid, 2 * pos + 1, i, val);
        //            updateUtil(mid + 1, r, 2 * pos + 2, i, val);
        //            tree[pos] = tree[2 * pos + 1] + tree[2 * pos + 2];
        //        }
    }

    static int counter = 0;
    static int[] rIn;
    static int[] rOut;
    static int[] lIn;
    static int[] lOut;
    private static int[] flatten;
    private static int[] lFlatten;
    static long answer = 0;

    static int VISITED = 1;
    static int VISITING = 2;

    static int[] DIRX = new int[]{0, 0, 1, -1};
    static int[] DIRY = new int[]{1, -1, 0, 0};

    public static class Pair22 {
        int num, pos;

        public Pair22(int x, int y) {
            this.num = x;
            this.pos = y;
        }
    }

    public static long sumofdig(long n) {
        long sum = 0;
        while (n > 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
    }

    public static void main(String[] args) throws Exception {
        //https://i...content-available-to-author-only...e.com/ebRGa6
        InputReader in = new InputReader(System.in);

        FastWriter out = new FastWriter(System.out);

//
//        f[0] = 1;
//        f[1] = 1;
//        for (int i = 2; i < 200001; ++i) {
//            f[i] = f[i-1] * i;
//            f[i] %= 1000000007;
//        }
        int t = in.readInt();

        while (t-- > 0) {

            int n = in.readInt();

            Stack<Integer> s = new Stack<>();

            System.out.println("1");
            int i1 = in.readInt();
            assert i1 == 1;
            s.add(1);
            for (int i = 1; i < n; ++i) {
                int next = in.readInt();
                if (next == 1) {
                } else {
                    while ((s.peek() + 1) != next) {
                        s.pop();
                    }
                    s.pop();
                }

                s.add(next);
                StringBuilder ans = new StringBuilder();
                for (int c: s) {
                    ans.append(c).append(".");
                }
                out.println(ans.substring(0, ans.length() - 1));
                out.flush();
            }

        }

    }

    private static void solvedd(int[] arr, int left, int right, int[] ans, int depth) {

        if (left > right) return;
        int maxInd = left;
        for (int i = left; i <= right; ++i) {
            if (arr[i] > arr[maxInd]) {
                maxInd = i;
            }
        }

        ans[maxInd] = depth;

        solvedd(arr, left, maxInd - 1, ans, depth + 1);
        solvedd(arr, maxInd + 1, right, ans, depth + 1);

    }

    private static void solved(List<List<Integer>> g, int node, int[][] dp, int last, int[] a) {

        int donttake = 0;
        int take = 0;
        for (int i = 0; i < g.get(node).size(); ++i) {
            int ntb = g.get(node).get(i);

            if (ntb != last) {
                solved(g, ntb, dp, node, a);
                donttake += Math.max(dp[ntb][0], dp[ntb][1]);
                take += dp[ntb][1];
            }
        }
        dp[node][0] = a[node] + take;
        dp[node][1] = donttake;
    }

    private static boolean solve(int n, List<Integer> nums, int cur, int pos, Boolean[][] dp) {
        if (cur > n) return false;
        if (cur == n) return true;
        if (pos >= nums.size()) return false;

        if (dp[cur][pos] != null) {
            return dp[cur][pos];
        }
        boolean without = solve(n, nums, cur, pos + 1, dp);
        boolean with = false;
        int ogcur = cur;
        for (int i = 1; i < 12; ++i) {
            with |= solve(n, nums, cur + nums.get(pos), pos + 1, dp);
            cur += nums.get(pos);
        }

        return dp[ogcur][pos] = with | without;
    }

//    private static Pair22 dfss(List<LinkedHashSet<Integer>> g, int node, HashSet<Integer> vis, int[] dis, int[] dis2) {
//        if (vis.contains(node)) return new Pair22(dis[node], dis2[node], -1);
//        vis.add(node);
//        int min = dis[node];
//        for (Integer ntb : g.get(node)) {
//            if (dis[ntb] > dis[node])
//                dfss(g, ntb, vis, dis, dis2);
//            if (dis[ntb] <= dis[node]) {
//                min = Math.min(min, dis[ntb]);
//            } else {
//                min = Math.min(min, dis2[ntb]);
//            }
//        }
//        //        if (dis)
//        dis2[node] = min;
//        return new Pair22(dis[node], min, -1);
//    }

    private static int dfs(HashMap<Pair, TreeSet<Pair>> grid, int x, int y, int ti, HashSet<Pair> vis, int r, int startX, int startY) {
        //        System.out.println(x + "  " + y);
        int taken = ti - Math.abs(startX - x) - Math.abs(startY - y);
        if (taken < 0) return 0;
        if (x < 0 || y < 0 || x > r || y > r) return 0;
        if (vis.contains(new Pair(x, y))) return 0;
        int max = 0;

        if (grid.containsKey(new Pair(x, y))) {
            TreeSet<Pair> times = grid.get(new Pair(x, y));
            for (Pair t : times) {
                if (t.a <= taken) {
                    max = Math.max(t.b, max);
                } else break;
            }
        }
        vis.add(new Pair(x, y));
        max = Math.max(dfs(grid, x + 1, y, ti, vis, r, startX, startY), max);
        max = Math.max(dfs(grid, x, y + 1, ti, vis, r, startX, startY), max);
        max = Math.max(dfs(grid, x - 1, y, ti, vis, r, startX, startY), max);
        max = Math.max(dfs(grid, x, y - 1, ti, vis, r, startX, startY), max);
        return max;
    }

    private static int solver(int[] nums, int pos, int[] dp) {
        if (pos >= nums.length) return 0;
        if (dp[pos] != Integer.MAX_VALUE) return dp[pos];
        int min = solver(nums, pos + 2, dp) + nums[pos];
        min = Math.min(solver(nums, pos + 3, dp) + nums[pos], min);
        if (pos + 1 < nums.length) min = Math.min(min, nums[pos] + nums[pos + 1] + solver(nums, pos + 3, dp));
        if (pos + 1 < nums.length) min = Math.min(min, nums[pos] + nums[pos + 1] + solver(nums, pos + 4, dp));

        //        System.out.println(pos + " " + min);
        return dp[pos] = min;
    }

    static int countFreq(String pattern, String text) {
        int m = pattern.length();
        int n = text.length();
        int res = 0;

        for (int i = 0; i <= n - m; i++) {
            int j;
            for (j = 0; j < m; j++) {
                if (text.charAt(i + j) != pattern.charAt(j)) {
                    break;
                }
            }
            if (j == m) {
                res++;
                j = 0;
            }
        }
        return res;
    }

    private static void dfsR(List<List<Integer>> g, int node, int[] v) {
        rIn[node] = counter;
        flatten[counter++] = v[node];

        for (int i = 0; i < g.get(node).size(); ++i) {
            dfsR(g, g.get(node).get(i), v);
        }

        rOut[node] = counter;
        flatten[counter++] = v[node] * -1;
    }

    private static void dfsL(List<List<Integer>> g, int node, int[] v) {
        lIn[node] = counter;
        lFlatten[counter++] = v[node];

        for (int i = 0; i < g.get(node).size(); ++i) {
            dfsL(g, g.get(node).get(i), v);
        }

        lOut[node] = counter;
        lFlatten[counter++] = v[node] * -1;

        TreeMap<String, Integer> map = new TreeMap<>();
    }

    private static void preprocess(int pos, int[][] pre, List<List<Integer>> tree, int[] traverse, int depth, int last, int[] tin, int[] tout) {
        tin[pos] = counter++;
        traverse[depth] = pos;

        for (int i = 0; depth - (1 << i) >= 0; ++i) {
            pre[pos][i] = traverse[depth - (1 << i)];
        }

        for (int i = 0; i < tree.get(pos).size(); ++i) {
            if (tree.get(pos).get(i) != last)
                preprocess(tree.get(pos).get(i), pre, tree, traverse, depth + 1, pos, tin, tout);
        }
        tout[pos] = counter++;
    }

    static long gcd(long a, long b) {

        while (b != 0) {
            long t = a;
            a = b;
            b = t % b;
        }
        return a;
    }

    static boolean submit = true;

    static void debug(String s) {
        if (!submit)
            System.out.println(s);
    }

    static void debug(int s) {
        LinkedHashSet<Integer> exist = new LinkedHashSet<>();
            /*

            4 2 3 _ 2 4 3 _
             */
    }

/**

 0 1 2 3 4 5 6 7 8 9 10

 1               1   1
 * Your ExamRoom object will be instantiated and called as such:
 * ExamRoom obj = new ExamRoom(N);
 * int param_1 = obj.seat();
 * obj.leave(p);
 */
}