codeparrot/codecomplex huggingface dataset:
// Problem: 1517_D. Explorer Space
// Time complexity: cubic

import java.util.*;
public class temp {
    public static void main(String str[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        int arr[][] = new int[n][m];
        int cross[][] = new int[n][m-1];
        int up[][] = new int[n-1][m];
        for(int i=0;i<n;i++){
            for(int j=0;j<m-1;j++){
                cross[i][j] = sc.nextInt();
            }
        }
        for(int i=0;i<n-1;i++){
            for(int j=0;j<m;j++){
                up[i][j] = sc.nextInt();
            }
        }
        int[][] fans = new int[n][m];
            if (k % 2 != 0) {
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        fans[i][j] = -1;
                    }
                }
            }
            else {
                int[][][] ans = new int[(k/2)+1][n][m];
                for (int l = 1; l <= k / 2; l++){
                    for (int i = 0; i < n ; i++) {
                        for (int j = 0; j < m; j++) {
                            int min = Integer.MAX_VALUE;
                            if(i>0){
                                min = Math.min(min, up[i-1][j] + ans[l-1][i-1][j]);
                            }
                            if(j>0){
                                min = Math.min(min, cross[i][j-1] + ans[l-1][i][j-1]);
                            }
                            if(i<n-1){
                                min = Math.min(min, up[i][j] + ans[l-1][i+1][j]);
                            }
                            if(j<m-1){
                                min = Math.min(min, cross[i][j] + ans[l-1][i][j+1]);
                            }
                            ans[l][i][j] = min;
                        }
                    }
                }
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        fans[i][j] = 2*ans[k/2][i][j];
                    }
                }
            }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                System.out.print(fans[i][j]+" ");
            }
            System.out.println();
        }


    }

}
// Problem: 1517_D. Explorer Space
// Time complexity: cubic
import java.io.*;

public class D7182 {
    public static void main(String[] args) throws IOException {
        init_io();
        int N = nint(), M = nint(), K = nint();
        if (K % 2 == 0) {
            int[][][] grid = new int[K+1][N][M];
            int[][][] edges = new int[4][N][M];
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M-1; j++) {
                    edges[0][i][j] = edges[2][i][j+1] = nint();
                }
            }
            for (int i = 0; i < N-1; i++) {
                for (int j = 0; j < M; j++) {
                    edges[1][i][j] = edges[3][i+1][j] = nint();
                }
            }
            for (int k = 1; k <= K/2; k++) {
                for (int i = 0; i < N; i++) {
                    for (int j = 0; j < M; j++) {
                        int min = Integer.MAX_VALUE;
                        if (i != N-1) {
                            min = Math.min(min, grid[k-1][i+1][j] + edges[1][i][j]);
                        }
                        if (j != M-1) {
                            min = Math.min(min, grid[k-1][i][j+1] + edges[0][i][j]);
                        }
                        if (i != 0) {
                            min = Math.min(min, grid[k-1][i-1][j] + edges[3][i][j]);
                        }
                        if (j != 0) {
                            min = Math.min(min, grid[k-1][i][j-1] + edges[2][i][j]);
                        }
                        grid[k][i][j] = min;
                    }
                }
            }
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    out.print(grid[K/2][i][j]*2 + " ");
                }
                out.println();
            }
        }
        else {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    out.print(-1 + " ");
                }
                out.println();
            }
        }
        out.close();
    }

    static StreamTokenizer in;
    static PrintWriter out;
    static BufferedReader br;

    static int nint() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    static void init_io() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        in = new StreamTokenizer(br);
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    }
}
// Problem: 1517_D. Explorer Space
// Time complexity: cubic
/* 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 Main
{
    public static int n;
    public static int m;
    public static int k;
    public static int[][] right;
    public static int[][] down;
    public static int[][][] dp;
    public static void recur(int i, int j, int depth)
    {
        if(dp[i][j][depth]!=-1)
            return;
        int min=Integer.MAX_VALUE;
        // left
        if(j>0)
        {
            recur(i, j-1, depth-1);
            min=Math.min(min, dp[i][j-1][depth-1] + right[i][j-1]);
        }
        // right
        if(j<m-1)
        {
            recur(i, j+1, depth-1);
            min=Math.min(min, dp[i][j+1][depth-1] + right[i][j]);
        }
        // up
        if(i>0)
        {
            recur(i-1, j, depth-1);
            min=Math.min(min, dp[i-1][j][depth-1] + down[i-1][j]);
        }
        // down
        if(i<n-1)
        {
            recur(i+1, j, depth-1);
            min=Math.min(min, dp[i+1][j][depth-1] + down[i][j]);

        }
        dp[i][j][depth]=min;
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        Scanner sc=new Scanner(System.in);
        n=sc.nextInt();
        m=sc.nextInt();
        k=sc.nextInt();
        right=new int[n][m-1];
        down=new int[n-1][m];
        for(int i=0;i<n;i++)
            for(int j=0;j<m-1;j++)
                right[i][j]=sc.nextInt();
        for(int i=0;i<n-1;i++)
            for(int j=0;j<m;j++)
                down[i][j]=sc.nextInt();
        if(k%2==1) {
            for(int i=0;i<n;++i) {
                for (int j = 0; j < m; j++)
                    System.out.print(-1 + " ");
                System.out.println();
            }
        }
        else
        {
            k/=2;
            dp=new int[n][m][k+1];
            for(int i=0;i<n;++i)
                for(int j=0;j<m;j++)
                    for(int z=1;z<=k;z++)
                        dp[i][j][z]=-1;
            for(int i=0;i<n;++i)
                for(int j=0;j<m;j++)
                    recur(i,j,k);
            for(int i=0;i<n;++i) {
                for (int j = 0; j < m; j++)
                    System.out.print((dp[i][j][k] * 2) + " ");
                System.out.println();
            }
        }
    }

}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int t = sc.nextInt();
    for (int tc = 0; tc < t; ++tc) {
      int n = sc.nextInt();
      int[] a = new int[n];
      for (int i = 0; i < a.length; ++i) {
        a[i] = sc.nextInt();
      }

      System.out.println(solve(a));
    }

    sc.close();
  }

  static String solve(int[] a) {
    List<String> result = new ArrayList<>();
    Stack<Integer> stack = new Stack<>();
    for (int ai : a) {
      if (ai != 1) {
        while (stack.peek() + 1 != ai) {
          stack.pop();
        }

        stack.pop();
      }
      stack.push(ai);

      result.add(stack.stream().map(String::valueOf).collect(Collectors.joining(".")));
    }

    return String.join("\n", result);
  }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
//I'm Whiplash99
import java.io.*;
import java.util.*;
public class C
{
    public static void main(String[] args) throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        int i,N;

        int T=Integer.parseInt(br.readLine().trim());
        StringBuilder sb=new StringBuilder();

        while (T-->0)
        {
            N=Integer.parseInt(br.readLine().trim());

            int[] a=new int[N];
            for(i=0;i<N;i++) a[i]=Integer.parseInt(br.readLine().trim());

            int end=1;
            int[][] ans=new int[N][N+10];

            ans[0][0]=1;
            for(i=1;i<N;i++)
            {
                while (true)
                {
                    if(ans[i-1][end]==a[i]-1) break;
                    end--;
                }
                for(int j=0;j<end;j++) ans[i][j]=ans[i-1][j];

                ans[i][end]=a[i];
                end++;
            }

            for(i=0;i<N;i++)
            {
                for(int j=0;j<N&&ans[i][j]!=0;j++)
                {
                    sb.append(ans[i][j]);
                    if(ans[i][j+1]!=0) sb.append('.');
                }
                sb.append("\n");
            }
        }
        System.out.println(sb);
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class C {
    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter pw;

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

    static int nextInt() {
        return Integer.parseInt(nextToken());
    }

    static long nextLong() {
        return Long.parseLong(nextToken());
    }

    static double nextDouble() {
        return Double.parseDouble(nextToken());
    }

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

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

    private static void solve() {
        int t = nextInt();
        int[] stack = new int[1000000];
        for (int i = 0; i < t; i++) {
            int n = nextInt();
            stack[0] = nextInt();
            int id = 1;
            pp(stack, id);
            for (int j = 1; j < n; j++) {
                int x = nextInt();
                if (x == 1) {
                    stack[id++] = x;
                } else {
                    while (true) {
                        int p = stack[--id];
                        if (p + 1 == x) {
                            stack[id++] = x;
                            break;
                        }
                    }
                }
                pp(stack, id);
            }
        }
    }

    private static void pp(int[] stack, int size) {
        for (int i = 0; i < size - 1; i++) {
            pw.print(stack[i] + ".");
        }
        pw.println(stack[size - 1]);
    }


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

/*
polyakoff
*/

public class Main {

    static FastReader in;
    static PrintWriter out;
    static Random rand = new Random();
    static final int oo = (int) 1e9 + 10;
    static final long OO = (long) 1e18 + 10;
    static final int MOD = (int) 1e9 + 7;


    static void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }

        Stack<Integer> st = new Stack<>();
        for (int i = 0; i < n; i++) {
            if (a[i] != 1) {
                while (!st.empty() && st.peek() + 1 != a[i])
                    st.pop();
                st.pop();
            }
            st.push(a[i]);
            for (int j = 0; j < st.size(); j++) {
                out.print(st.get(j));
                if (j < st.size() - 1)
                    out.print('.');
            }
            out.println();
        }

    }

    public static void main(String[] args) {
        in = new FastReader();
        out = new PrintWriter(System.out);

        int t = 1;
        t = in.nextInt();
        while (t-- > 0) {
            solve();
        }

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

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader() {
            this(System.in);
        }
        FastReader(String file) throws FileNotFoundException {
            this(new FileInputStream(file));
        }
        FastReader(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(nextLine());
            }
            return st.nextToken();
        }
        String nextLine() {
            String line;
            try {
                line = br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }
    }
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

import java.lang.*;

public class Practice {
	public static long mod = (long) Math.pow(10, 9) + 7;
	public static long tt = 0;

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		int c = 1;
		int t = Integer.parseInt(br.readLine());

		while (t-- > 0) {
			int n = Integer.parseInt(br.readLine());
			HashMap<Integer, Integer> map = new HashMap<>();
			// map.put(1, 0);
			int curr = 0;
			for (int i = 0; i < n; i++) {
				int tt = Integer.parseInt(br.readLine());
				if (tt == 1) {
					curr++;
					map.put(curr, 1);
				} else {
					ArrayList<Integer> list = new ArrayList<Integer>(map.keySet());
					Collections.sort(list);
					for (int a = list.size() - 1; a >= 0; a--) {
						if (map.get(list.get(a)) == tt - 1) {
							map.put(list.get(a), tt);
							break;
						} else {
							curr--;
							map.remove(list.get(a));
						}
					}
				}
				ArrayList<Integer> list = new ArrayList<Integer>(map.keySet());
				Collections.sort(list);
				StringBuilder str=new StringBuilder();
				for(int a=0;a<list.size();a++) {
					if(list.size()-1==a) {
						str.append(map.get(list.get(a)));
						continue;
					}
					str.append(map.get(list.get(a))+".");
				}pw.println(str);

			}

		}
		pw.close();
	}

//	private static long getGCD(long l, long m) {
//		// TODO Auto-generated method stub
//
//		long t1 = Math.min(l, m);
//		long t2 = Math.max(l, m);
//		while (true) {
//			long temp = t2 % t1;
//			if (temp == 0) {
//				return t1;
//			}
//			t2 = t1;
//			t1 = temp;
//		}
//	}
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[])
    {
        FastReader input=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        int T=input.nextInt();
        while(T-->0)
        {
            int n=input.nextInt();
            int b[]=new int[n];
            for(int i=0;i<n;i++)
            {
                b[i]=input.nextInt();
            }
            StringBuilder sb=new StringBuilder("");
            int arr[]=new int[n+1];
            out.println('1');
            sb.append('1');
            int size=1;
            arr[size-1]=1;
            for(int i=1;i<n;i++)
            {
                int a=b[i];
                if(a==1)
                {
                    size++;
                    arr[size-1]=1;
                    sb.append(".1");
                    out.println(sb.toString());
                }
                else
                {
                    sb=new StringBuilder("");
                    int in=0;
                    for(int j=size-1;j>=0;j--)
                    {
                        if(arr[j]==a-1)
                        {
                            in=j;
                            break;
                        }
                    }
                    for(int j=0;j<in;j++)
                    {
                        sb.append(arr[j]+".");
                    }
                    sb.append(a);
                    size=in+1;
                    arr[size-1]=a;
                    out.println(sb.toString());
                }
            }
        }
        out.close();
    }
    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());
        }
        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 C1523 {
	public static void print(Stack<Integer> st, PrintWriter pw) {
		for (int i = 0; i < st.size(); i++) {
			pw.print(st.get(i));
			if (i != st.size() - 1) {
				pw.print(".");
			}
		}
		pw.println();
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int[] arr = sc.nextIntArr(n);
			Stack<Integer> st = new Stack<Integer>();
			st.add(arr[0]);
			print(st, pw);
			for (int i = 1; i < n; i++) {
				if (arr[i] == 1) {
					st.add(arr[i]);
				} else {
					while (st.peek() != arr[i] - 1) {
						st.pop();
					}
					st.pop();
					st.add(arr[i]);
				}
				print(st, pw);
			}
		}
		pw.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

	}

}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
/* 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
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		for(int q=0;q<t;q++){
		      String s = br.readLine();
		      int n = Integer.parseInt(s);
		      int a[] = new int[1000];
		      int index=0;
		      for(int i=0;i<n;i++){
		            int x = Integer.parseInt(br.readLine());
		            for(int j=index;j>=0;j--){
		                  if(x-1==a[j]){
		                        a[j]=x;
		                  
		                  for(int k=0;k<j;k++){
		                        System.out.print(a[k]+".");
		                  }
		                  System.out.print(a[j]);
		                  System.out.println();
		                  for(int k=j+1;k<1000;k++){
		                        if(a[k]!=0)
		                        a[k]=0;
		                        else 
		                        break;
		                  }
		                  index=j+1;
		                //  System.out.println(a[j]+"*"+j);
		                  break;
		                  }
		            }
		      }
		}
	}
}
// Problem: 1523_C. Compression and Expansion
// Time complexity: cubic
import java.io.*;
import java.util.*;

public class C {

	static int ar[];
	static HashMap<String, ArrayList<String>> map;
	static int location = 0;
	static StringBuilder sb;
	static int N;
	
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		int t = Integer.parseInt(br.readLine());
		
		while(t --> 0) {
			
			int n = Integer.parseInt(br.readLine());
			ar = new int[n];
			location = 0;
			map = new HashMap<String, ArrayList<String>>();
			sb = new StringBuilder();
			N = n;
						
			for(int i = 0; i < n; i++) {
				
				ar[i] = Integer.parseInt(br.readLine());
				
			}
			
			int idx = 2;
			location = 1;
			
			sb.append("1\n");
			
			while(location < n) {
				
				if(ar[location] == 1) {
					
					nl((idx-1)+".");
					
				}else {
					
					sb.append(idx+"\n");
					idx++;
					location++;
					
				}
				
			}
			
			System.out.println(sb);
			
		}	
		
	}
	
	public static void nl(String l) {
		
		int idx = 1;
		//System.out.println(location + " " + l);
		
		while(location < N) {
						
			if(idx == ar[location]) {
				
				sb.append(l + idx + "\n");
				idx++;
				location++;
				
			}else if(ar[location] == 1) {
				
				nl(l + (idx-1) + ".");
				
			}else {
				
				return;
				
			}
			
		}
		
	}

}