
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;


public class Main {
	
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
		
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		String[] as = s.split(" ");
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		output(a);
		insertionSort(a,n);
	}

	private static void insertionSort(int[] a, int n) {
		// TODO Auto-generated method stub
		for(int i = 1; i < n; i++) {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		}
	}

	private static void output(int[] a) {
		// TODO Auto-generated method stub
		for(int i = 0; i < a.length-1; i++) {
			System.out.print(a[i] + " ");
			
		}
		
		System.out.println(a[a.length-1]);
	}
	
	
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.nio.charset.StandardCharsets; StandardCharsets java.nio.charset public class Main {
	
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
		
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		String[] as = s.split(" ");
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		output(a);
		insertionSort(a,n);
	}

	private static void insertionSort(int[] a, int n) {
		// TODO Auto-generated method stub
		for(int i = 1; i < n; i++) {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		}
	}

	private static void output(int[] a) {
		// TODO Auto-generated method stub
		for(int i = 0; i < a.length-1; i++) {
			System.out.print(a[i] + " ");
			
		}
		
		System.out.println(a[a.length-1]);
	}
	
	
} Main public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
		
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		String[] as = s.split(" ");
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		output(a);
		insertionSort(a,n);
	} main {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
		
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		String[] as = s.split(" ");
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		output(a);
		insertionSort(a,n);
	} InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); reader new InputStreamReader(System.in, StandardCharsets.UTF_8) BufferedReader in = new BufferedReader(reader); in new BufferedReader(reader) String s = in.readLine(); s in.readLine() in.readLine in int n = Integer.parseInt(s); n Integer.parseInt(s) Integer.parseInt Integer s s = in.readLine() s in.readLine() in.readLine in String[] as = s.split(" "); as s.split(" ") s.split s " " int[] a = new int[n]; a new int[n] n for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = Integer.parseInt(as[i]);
		} {
			a[i] = Integer.parseInt(as[i]);
		} a[i] = Integer.parseInt(as[i]) a[i] a i Integer.parseInt(as[i]) Integer.parseInt Integer as[i] as i output(a) output a insertionSort(a,n) insertionSort a n String[] args args private static void insertionSort(int[] a, int n) {
		// TODO Auto-generated method stub
		for(int i = 1; i < n; i++) {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		}
	} insertionSort {
		// TODO Auto-generated method stub
		for(int i = 1; i < n; i++) {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		}
	} for(int i = 1; i < n; i++) {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		} {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		} int v = a[i]; v a[i] a i int j = i - 1; j i - 1 i 1 while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			} j >= 0 && a[j] > v j >= 0 j 0 a[j] > v a[j] a j v {
				a[j+1] = a[j];
				j--;
			} a[j+1] = a[j] a[j+1] a j+1 j 1 a[j] a j j-- j a[j+1] = v a[j+1] a j+1 j 1 v output(a) output a int[] a a int n n private static void output(int[] a) {
		// TODO Auto-generated method stub
		for(int i = 0; i < a.length-1; i++) {
			System.out.print(a[i] + " ");
			
		}
		
		System.out.println(a[a.length-1]);
	} output {
		// TODO Auto-generated method stub
		for(int i = 0; i < a.length-1; i++) {
			System.out.print(a[i] + " ");
			
		}
		
		System.out.println(a[a.length-1]);
	} for(int i = 0; i < a.length-1; i++) {
			System.out.print(a[i] + " ");
			
		} int i = 0; int i = 0; i 0 i < a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
			System.out.print(a[i] + " ");
			
		} {
			System.out.print(a[i] + " ");
			
		} System.out.print(a[i] + " ") System.out.print System.out System System.out a[i] + " " a[i] a i " " System.out.println(a[a.length-1]) System.out.println System.out System System.out a[a.length-1] a a.length-1 a.length a a.length 1 int[] a a public class Main {
	
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
		
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		String[] as = s.split(" ");
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		output(a);
		insertionSort(a,n);
	}

	private static void insertionSort(int[] a, int n) {
		// TODO Auto-generated method stub
		for(int i = 1; i < n; i++) {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		}
	}

	private static void output(int[] a) {
		// TODO Auto-generated method stub
		for(int i = 0; i < a.length-1; i++) {
			System.out.print(a[i] + " ");
			
		}
		
		System.out.println(a[a.length-1]);
	}
	
	
} public class Main {
	
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
		
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		String[] as = s.split(" ");
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		output(a);
		insertionSort(a,n);
	}

	private static void insertionSort(int[] a, int n) {
		// TODO Auto-generated method stub
		for(int i = 1; i < n; i++) {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		}
	}

	private static void output(int[] a) {
		// TODO Auto-generated method stub
		for(int i = 0; i < a.length-1; i++) {
			System.out.print(a[i] + " ");
			
		}
		
		System.out.println(a[a.length-1]);
	}
	
	
} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;


public class Main {
	
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
		
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		String[] as = s.split(" ");
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		output(a);
		insertionSort(a,n);
	}

	private static void insertionSort(int[] a, int n) {
		// TODO Auto-generated method stub
		for(int i = 1; i < n; i++) {
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			output(a);
		}
	}

	private static void output(int[] a) {
		// TODO Auto-generated method stub
		for(int i = 0; i < a.length-1; i++) {
			System.out.print(a[i] + " ");
			
		}
		
		System.out.println(a[a.length-1]);
	}
	
	
}
