codeparrot/codecomplex huggingface dataset:
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.*;
import java.util.*;

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

                if(f==-1)
                {
                    cr++;
                    f=cr;
                }
                cur[f]=d;
                cr=f;
                for(j=f+1;j<n;j++) cur[j]=0;
                sb.append(cur[0]);
                for(j=1;j<n;j++)
                if(cur[j]==0) break;
                else sb.append("."+cur[j]);
                sb.append("\n");
            }
        }
        System.out.print(sb);
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.*;
import java.util.*;

public class q3 {

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

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

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

                        int val = Integer.parseInt(temp.substring(idx));
                        temp.delete(idx,temp.length());
                        if(curr == val + 1){
                            temp.append(String.valueOf(curr));
                            break;
                        }
                        temp.deleteCharAt(temp.length() - 1);
                    }
                    System.out.println(temp);
                }
            }
        }
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        int n=ni();
        int[]A=new int[n];
        int point = -1;
        for(int _i=0;_i<n;_i++){
            int x =ni();
            if(x==1){
                point++;
                A[point]=1;
            }
            else{
                while(x!=A[point]+1){
                    A[point]=0;
                    point--;
                }
            }
            A[point]=x;
            for(int i=0;i<point;i++)
                p(A[i]+".");
            pn(A[point]);

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

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

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

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.*;
import java.util.*;

public class C{
	
	public static void main(String[] args) throws IOException {
		// br = new BufferedReader(new FileReader(".in"));
		// out = new PrintWriter(new FileWriter(".out"));
		//new Thread(null, new (), "peepee", 1<<28).start();
		read();
		int t= RI();
		while(t-->0) {
			read();
			int n = RI();
			List<Integer> cur = new ArrayList<Integer>();
			int[] lvl = new int[n+10];
			while(n-->0) {
				read();
				int x = RI();
				
				if (cur.size() == 0) {
					cur.add(x);
					lvl[cur.size()]=x;
				}
				else {
					while (!cur.isEmpty()) {
						if (x == 1+lvl[cur.size()]) {
							int size = cur.size();
							cur.remove(size-1);
							cur.add(1+lvl[size]);
							lvl[size] = x;
							break;
						}
						else {
							// Either add to a new level or go to existing one.
							if (x == 1) {
								// add
								cur.add(x);
								lvl[cur.size()] = x;
								break;
							}
							else {
								lvl[cur.size()] = 0;
								cur.remove(cur.size()-1);
							}
						}
					}
					if (cur.size() == 0) {
						cur.add(x);
						lvl[cur.size()]=x;
					}
				}
				
				
				for (int i = 0; i < cur.size(); i++) {
					out.print(cur.get(i));
					if (i != cur.size()-1) out.print(".");
				}
				out.println();
			}
		}
		out.close();
	}
	
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	static StringTokenizer st;
	static void read() throws IOException{st = new StringTokenizer(br.readLine());}	
	static int RI() throws IOException{return Integer.parseInt(st.nextToken());}
	static long RL() throws IOException{return Long.parseLong(st.nextToken());}
	static double RD() throws IOException{return Double.parseDouble(st.nextToken());}
	
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import javafx.util.Pair;

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

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

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

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

        System.out.flush();
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
/*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
 */
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;

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

public class C_1523 {

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

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

}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.*;
import java.util.*;
import java.math.*;

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

		/**/
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		/*/
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream("src/c.in"))));
		/**/
		
		int t = sc.nextInt();
		for (int z = 0; z < t; ++z) {
			int n = sc.nextInt();
			ArrayList<Integer> al = new ArrayList<>();
			for (int i = 0; i < n; ++i) {
				int x = sc.nextInt();
				if (x==1) {
					al.add(x);
				} else {
					while (al.get(al.size()-1)!=x-1) {
						al.remove(al.size()-1);
					}
					al.remove(al.size()-1);
					al.add(x);
				}
				StringBuilder pr = new StringBuilder();
				String d = "";
				for (int xx : al) {
					pr.append(d+xx);
					d = ".";
				}
				System.out.println(pr);
			}
		}
	}
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.util.*;
import java.io.*;

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

        }
        out.close();
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class C {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        int t = Integer.parseInt(buffer.readLine());
        while (t-- > 0) {
            int n = Integer.parseInt(buffer.readLine());
            ArrayList<Integer>list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                int a = Integer.parseInt(buffer.readLine());
                if (a == 1)
                    list.add(1);
                else {
                    for (int j = list.size()-1; j >= 0; j--) {
                        if (list.get(j)+1 == a)
                            break;
                        list.remove(list.size()-1);
                    }
                    list.remove(list.size()-1);
                    list.add(a);
                }
                for (int j = 0; j < list.size(); j++) {
                    sb.append(list.get(j));
                    if (j == list.size()-1)
                        sb.append("\n");
                    else
                        sb.append(".");
                }
            }
        }
        System.out.println(sb);
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.io.IOException;
import java.io.BufferedReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;

public class p3
{
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

		byte nextByte() { return Byte.parseByte(next()); }

		short nextShort() { return Short.parseShort(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;
		}
	}

	public static void main(String[] args)
	{
		FastReader fr=new FastReader();

		byte t=fr.nextByte();
		while(t-->0)
		{
			short n=fr.nextShort();
			short a[]=new short [n];
			for (short i=-1;++i<n;)
				a[i]=fr.nextShort();
			
			String s="1";
			System.out.println(s);

			for(short i=0;++i<n;)
			{
				if(a[i]==1)
				{
					s+=".1";
					System.out.println(s);
				}
				else if(a[i]==a[i-1]+1)
				{
					int c=s.lastIndexOf(".");
					s=s.substring(0,c+1)+a[i];
					System.out.println(s);
				}
				else
				{					
					for(;;)
					{
						s=s.substring(0,s.lastIndexOf("."));
						int c=s.lastIndexOf(".");

						int b=Integer.parseInt(s.substring(c+1,s.length()));
						if(b+1==a[i])
						{
							s=s.substring(0,c+1)+a[i];
							System.out.println(s);
							break;
						}
					}
				}
			}
		}
	}
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;


public class Solution {
    public static void main(String[] args)throws IOException {
        FastReader in=new FastReader(System.in);
        int t=in.nextInt();
        StringBuilder sb=new StringBuilder();
        int i,j,tc=0;
        while(tc++<t) {
            int n=in.nextInt();
            int arr[]=new int[n];
            for(i=0;i<n;i++)
                arr[i]=in.nextInt();
            int ans[]=new int[n+4];
            ans[0]=1;
            int pos=0;
            sb.append("1\n");
            for(i=1;i<n;i++){
                if(arr[i]==arr[i-1]+1){
                    ans[pos]=ans[pos]+1;
                }
                else if(arr[i]==1){
                    pos++;
                    ans[pos]=1;
                }
                else{
                    while(ans[pos]!=arr[i]-1)
                        pos--;
                    ans[pos]=ans[pos]+1;
                }
                for(j=0;j<=pos;j++){
                    if(j<pos)
                        sb.append(ans[j]).append(".");
                    else
                        sb.append(ans[j]).append("\n");
                }

            }
        }
        System.out.println(sb);
    }
}

class Node {
    int setroot, dist;
    public Node(int setroot, int dist){
        this.setroot = setroot;
        this.dist = dist;
    }
    @Override
    public String toString() {
        return String.format(setroot + ", " + dist);
    }
}

class FastReader {

    byte[] buf = new byte[2048];
    int index, total;
    InputStream in;

    FastReader(InputStream is) {
        in = is;
    }

    int scan() throws IOException {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0) {
                return -1;
            }
        }
        return buf[index++];
    }

    String next() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }

    int nextInt() throws IOException {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }

    long nextLong() throws IOException {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
}