codeparrot/codecomplex huggingface dataset:
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.arraycopy;
import static java.lang.System.exit;
import static java.util.Arrays.copyOf;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;

public class C {

	static class IntList {

		int data[] = new int[3];
		int size = 0;

		boolean isEmpty() {
			return size == 0;
		}

		int size() {
			return size;
		}

		int get(int index) {
			if (index < 0 || index >= size) {
				throw new IndexOutOfBoundsException();
			}
			return data[index];
		}

		void clear() {
			size = 0;
		}

		void set(int index, int value) {
			if (index < 0 || index >= size) {
				throw new IndexOutOfBoundsException();
			}
			data[index] = value;
		}

		void expand() {
			if (size >= data.length) {
				data = copyOf(data, (data.length << 1) + 1);
			}
		}

		void insert(int index, int value) {
			if (index < 0 || index > size) {
				throw new IndexOutOfBoundsException();
			}
			expand();
			arraycopy(data, index, data, index + 1, size++ - index);
			data[index] = value;
		}

		int delete(int index) {
			if (index < 0 || index >= size) {
				throw new IndexOutOfBoundsException();
			}
			int value = data[index];
			arraycopy(data, index + 1, data, index, --size - index);
			return value;
		}

		void push(int value) {
			expand();
			data[size++] = value;
		}

		int pop() {
			if (size == 0) {
				throw new NoSuchElementException();
			}
			return data[--size];
		}

		void unshift(int value) {
			expand();
			arraycopy(data, 0, data, 1, size++);
			data[0] = value;
		}

		int shift() {
			if (size == 0) {
				throw new NoSuchElementException();
			}
			int value = data[0];
			arraycopy(data, 1, data, 0, --size);
			return value;
		}
	}

	static void solve() throws Exception {
		int tests = scanInt();
		IntList stack = new IntList();
		for (int test = 0; test < tests; test++) {
			stack.clear();
			int n = scanInt();
			for (int i = 0; i < n; i++) {
				int v = scanInt();
				if (v == 1) {
					stack.push(v);
				} else {
					while (stack.pop() != v - 1) { }
					stack.push(v);
				}
				for (int j = 0; j < stack.size; j++) {
					if (j != 0) {
						out.print('.');
					}
					out.print(stack.data[j]);
				}
				out.println();
			}
		}
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.util.*;
import java.io.*;
public class B{
	public static void main(String[] args)
	{
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int t = fs.nextInt();
		for(int tt=0;tt<t;tt++)
		{
			int n = fs.nextInt();
			int[] arr = fs.readArray(n);
			List<String> ans = new ArrayList();
			List<Integer> temp = new ArrayList();
			temp.add(arr[0]);
			ans.add(""+arr[0]);
			for(int i=1;i<n;i++)
			{
				int ch = arr[i];
				if(ch == 1)
				{
					temp.add(1);
					StringBuilder sb = new StringBuilder();
					for(int j=0;j<temp.size();j++)
					{
						sb.append(temp.get(j));
						if(j != temp.size()-1)
						{
							sb.append('.');
						}
					}
					ans.add(sb.toString());
				}
				else
				{
					int j = temp.size()-1;
					while(j>=0)
					{
						if(ch - temp.get(j) == 1)
						{
							temp.set(j,ch);
							break;
						}
						else
						{
							j--;
						}
					}
					int extra = temp.size()-1;
					while(extra>j)
					{
						temp.remove(temp.size()-1);
						extra--;
					}
					StringBuilder sb = new StringBuilder();
					for(int jj=0;jj<temp.size();jj++)
					{
						sb.append(temp.get(jj));
						if(jj != temp.size()-1)
						{
							sb.append('.');
						}
					}
					ans.add(sb.toString());
				}
//				out.println("Here: "+temp);
			}
			for(String str:ans)
			{
				out.println(str);
			}
		}
		out.close();
	}
	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());
		}
	}
	public static int[] sort(int[] arr)
	{
		List<Integer> temp = new ArrayList();
		for(int i:arr)temp.add(i);
		Collections.sort(temp);
		int start = 0;
		for(int i:temp)arr[start++]=i;
		return arr;
	}
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Stack;

public class Main {

    static void debug(Object... args) {
        System.out.println(Arrays.deepToString(args));
    }

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        int T = Integer.parseInt(br.readLine());
        while (T-- > 0) {
            int N = Integer.parseInt(br.readLine());
            Stack<LN> nodes = new Stack<>();
            int a0 = Integer.parseInt(br.readLine());
            LN root = new LN(1, 0, "");
            nodes.add(root);
            pw.println(root);
            for (int i = 0; i < N - 1; i++) {
                int ai = Integer.parseInt(br.readLine());
                while (!nodes.isEmpty()) {
                    LN nn = nodes.pop();
                    if (ai == 1) {
                        LN e = new LN(1, nn.depth + 1, nn.toString());
                        nodes.add(nn);
                        nodes.add(e);
                        pw.println(e);
                        break;
                    } else if (nn.lv == ai - 1) {
                        LN e = new LN(ai, nn.depth, nn.base);
                        nodes.add(e);
                        pw.println(e);
                        break;
                    }
                }
            }
        }
        pw.flush();
    }

    static class LN {
        int lv;
        int depth;
        String base;

        public LN(int lv, int depth, String prev) {
            this.lv = lv;
            this.depth = depth;
            base = prev;
        }

        @Override
        public String toString() {
            StringBuilder bob = new StringBuilder(base);
            if (depth > 0) {
                bob.append(".");
            }
            bob.append(lv);
            return bob.toString();
        }
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.util.*;
import java.io.*;
public class C {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int T = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		while(T-->0) {
			int n = sc.nextInt();
			int[] arr = new int[n];
			for(int i = 0; i < n; i++) {
				arr[i] = sc.nextInt();
			}
			int[] p = new int[n];
			int[] base = new int[n];
			p[0] = -1;
			base[0] = -1;
			boolean[] used = new boolean[n];
			for(int i = 1; i < n; i++) {
				if(arr[i] == 1) {
					p[i] = i-1;
					base[i] = i-1;
				}
				else {
					for(int j = i-1; j >= 0; j--) {
						if(used[j]) continue;
						if(arr[j] == arr[i]-1) {
							p[i] = j; used[j] = true; 
							base[i] = base[j]; break;
						}
						else used[j] = true;
					}
				}
			}
			StringBuilder[] res = new StringBuilder[n];
			res[0] = new StringBuilder("1");
			sb.append("1\n");
			for(int i = 1; i < n; i++) {
				if(base[i] == -1) { 
					res[i] = new StringBuilder();
				}
				else {
					res[i] = new StringBuilder(res[base[i]]);
					res[i].append(".");
				}
				res[i].append(arr[i]+"");
				sb.append(res[i]);
				sb.append("\n");
			}
		}	
		PrintWriter pw = new PrintWriter(System.out);
		pw.println(sb.toString().trim());
		pw.flush();
	}
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 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());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import javax.print.DocFlavor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class p1523C {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t ; i++) {
            int n = sc.nextInt();
            ArrayList<Stack<Integer>> ar = new ArrayList<Stack<Integer>>();
            for (int j = 0; j < n + 1; j++) {
                ar.add(new Stack<Integer>());
            }
            HashMap <Integer , Integer> hm = new HashMap<Integer, Integer>();
            StringBuilder cur = new StringBuilder();
            int l = 0;
            for (int j = 0; j < n; j++) {
                int a = sc.nextInt();
                if( a == 1)
                {
                    if(cur.length() == 0)
                        cur.append("1");
                    else
                        cur.append(".1");
                    l++;
                    ar.get(1).add(l);
                    hm.put(l , 1);
                }
                else
                {
                    int newl = ar.get( a - 1).pop();
                    for (int k = newl + 1; k <= l ; k++) {
                        ar.get(hm.get(k)).pop();
                        hm.remove(k);
                        cur.delete(cur.lastIndexOf(".")  + 1, cur.length());
                        cur.delete(cur.length() - 1 , cur.length());
                    }
                    cur.delete(cur.lastIndexOf(".")  + 1, cur.length());
                    cur.append(a);
                    ar.get(a).add(newl);
                    hm.put(newl , a);
                    l = newl;
                }
                System.out.println(cur);
            }

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

public class Main {
    private static HashMap<String, Integer> nodes;
    private static void dfs(String cur, PrintWriter out) {
        if(cur.length() > 0) {
            out.println(cur.substring(1));
        }
        int children = nodes.get(cur);
        for(int i = 1; i <= children; i++) {
            dfs(cur+"."+i, out);
        }
    }
    public static void main(String[] args) throws IOException {
        //Scanner f = new Scanner(new File("uva.in"));
        //Scanner f = new Scanner(System.in);
        //BufferedReader f = new BufferedReader(new FileReader("uva.in"));
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int t = Integer.parseInt(f.readLine());
        while(t-- > 0) {
            int n = Integer.parseInt(f.readLine());
            nodes = new HashMap<>();
            nodes.put("", 0);
            String cur = "";
            for(int i = 0; i < n; i++) {
                int a = Integer.parseInt(f.readLine());
                while(nodes.get(cur) != a-1) {
                    cur = cur.substring(0, cur.lastIndexOf("."));
                }
                nodes.put(cur, a);
                cur = cur+"."+a;
                nodes.put(cur, 0);
            }
            dfs("", out);
        }
        f.close();
        out.close();
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.lang.*;
import java.util.*;
import java.io.*;

public class Main {    
    static void deal(int n,int[] arr) {
        int[] a = new int[n];
        a[0] = 1;
        int l = 1;
        out.println(toString(a,l));
        for(int i=1;i<n;i++) {
            if(arr[i] == 1) {
                a[l] = 1;
                l++;
            } else {
                int index = l-1;
                while(index>=0 && a[index] != arr[i]-1) {
                    index--;
                }
                a[index]++;
                l = index+1;
            }
            out.println(toString(a,l));
        }
    }
    
    static String toString(int[] arr,int l) {
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<l-1;i++) {
            sb.append(arr[i]);
            sb.append('.');
        }
        sb.append(arr[l-1]);
        return sb.toString();
    }
    
	public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int t = sc.nextInt();
        for(int i=0;i<t;i++) {
            int n = sc.nextInt();
            int[] arr = new int[n];
            for(int j=0;j<n;j++) arr[j] = sc.nextInt();
            deal(n,arr);
        }
        out.close();
    }
    
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    
    //-----------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;
        }
        
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.util.*;
import java.io.*;

public class C
{

	static FastIO f;

	public static void main(String args[]) throws IOException
	{
		f = new FastIO();

		int t, n, a, i;
		Node r, p, c;
		
		t = f.ni();
		
		while(t-->0)
		{
			n = f.ni();
			r = p = new Node(-1, null);
			// f.out("1\n");

			for(i = 0; i < n; i++)
			{
				a = f.ni();
				if(a != 1)
				{
					while(a != p.i + 1)
						p = p.p;
					p = p.p;
				}
				// if(a == p.i + 1)
				// 	p = p.p;
				// else if(p.p != null && a == p.p.i + 1)
				// 	p = p.p.p;
				c = new Node(a, p);
				p.c.add(c);
				p = c;
			}

			dfs(r, "");
		}

		f.flush();
	}

	public  static void dfs(Node n, String s) throws IOException
	{
		String t;

		if(n.i == -1)
			t = s;
		else
		{
			t = s + n.i + ".";
			f.out(s + n.i + "\n");
		}

		for(Node c : n.c)
			dfs(c, t);
	}

	static class Node
	{
		int i;
		Node p;
		ArrayList<Node> c;
	
		Node(int x, Node y)
		{
			i = x;
			p = y;
			c = new ArrayList<>();
		}
	
		@Override
		public int hashCode()
		{
			return super.hashCode();
		}
	
		@Override
		public boolean equals(Object obj)
		{
			Node that = (Node)obj;
	
			return super.equals(obj);
		}
	
		@Override
		public String toString()
		{
			return "[" + "PARAMETERS" + "]";
		}
	}

	public static class FastIO
	{
		BufferedReader br;
		BufferedWriter bw, be;
		StringTokenizer st;

		public FastIO()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
			bw = new BufferedWriter(new OutputStreamWriter(System.out));
			be = new BufferedWriter(new OutputStreamWriter(System.err));
			st = new StringTokenizer("");
		}

		private void read() throws IOException
		{
			st = new StringTokenizer(br.readLine());
		}

		public String ns() throws IOException
		{
			while(!st.hasMoreTokens())
				read();
			return st.nextToken();
		}

		public int ni() throws IOException
		{
			return Integer.parseInt(ns());
		}

		public long nl() throws IOException
		{
			return Long.parseLong(ns());
		}

		public float nf() throws IOException
		{
			return Float.parseFloat(ns());
		}

		public double nd() throws IOException
		{
			return Double.parseDouble(ns());
		}

		public char nc() throws IOException
		{
			return ns().charAt(0);
		}

		public int[] nia(int n) throws IOException
		{
			int[] a = new int[n];
			for(int i = 0; i < n; i++)
				a[i] = ni();

			return a;
		}

		public long[] nla(int n) throws IOException
		{
			long[] a = new long[n];
			for(int i = 0; i < n; i++)
				a[i] = nl();

			return a;
		}

		public char[] nca() throws IOException
		{
			return ns().toCharArray();
		}

		public void out(String s) throws IOException
		{
			bw.write(s);
		}

		public void flush() throws IOException
		{
			bw.flush();
			be.flush();
		}

		public void err(String s) throws IOException
		{
			be.write(s);
		}
	}
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.util.*;
import java.io.*;

public class C{

	private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

	public static void main (String[] args) throws IOException {
        int t = Integer.parseInt(br.readLine());
        while(t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            int prev = 1;
            ArrayList<Integer> nums = new ArrayList<>();
            nums.add(1);
            String till = "1";
            for(int i=0;i<n;i++) {
                int ln = Integer.parseInt(br.readLine());
                if(i == 0) {
                    bw.write("1\n");
                    continue;
                }
                if(ln == 1) {
                    nums.add(1);
                }else if(ln == prev + 1) {
                    nums.set(nums.size()-1, ln);
                }else {
                    int idx = -1;
                    for(int j=nums.size()-1;j>=0;j--) {
                        if(nums.get(j) == ln-1) {
                            idx = j;
                            break;
                        }
                    }
                    ArrayList<Integer> temp = new ArrayList<>();
                    for(int j=0;j<idx;j++) {
                        temp.add(nums.get(j));
                    }
                    temp.add(ln);
                    nums.clear();
                    nums = temp;
                }
                for(int j=0;j<nums.size()-1;j++) {
                    bw.write(nums.get(j) + ".");
                }
                bw.write(nums.get(nums.size()-1) + "\n");
                prev = ln;
            }
            
        }
        bw.flush();
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
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;
        }


    }

}