import java.util.Scanner;

class Main {
	public static void bubble(int[] A) {
		int N = A.length;
        for(int k=0;k<N;k++) {
            System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
        }
		System.out.println("");
		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;
			for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			}
			System.out.println("");
		}
	}
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int A[] = new int[n];
		in.nextLine();
		String[] A_str = in.nextLine().split(" ");
		for(int i=0;i<n;i++) A[i] = Integer.parseInt(A_str[i]);

		bubble(A);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void bubble(int[] A) {
		int N = A.length;
        for(int k=0;k<N;k++) {
            System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
        }
		System.out.println("");
		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;
			for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			}
			System.out.println("");
		}
	}
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int A[] = new int[n];
		in.nextLine();
		String[] A_str = in.nextLine().split(" ");
		for(int i=0;i<n;i++) A[i] = Integer.parseInt(A_str[i]);

		bubble(A);
	}
} Main public static void bubble(int[] A) {
		int N = A.length;
        for(int k=0;k<N;k++) {
            System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
        }
		System.out.println("");
		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;
			for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			}
			System.out.println("");
		}
	} bubble {
		int N = A.length;
        for(int k=0;k<N;k++) {
            System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
        }
		System.out.println("");
		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;
			for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			}
			System.out.println("");
		}
	} int N = A.length; N A.length A A.length for(int k=0;k<N;k++) {
            System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
        } int k=0; int k=0; k 0 k<N k N k++ k++ k {
            System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
        } {
            System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
        } System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " "))) System.out.print System.out System System.out String.format("%d%s", A[k], (k==N-1 ? "" : " ")) String.format String "%d%s" A[k] A k (k==N-1 ? "" : " ") k==N-1 k N-1 N 1 "" " " System.out.println("") System.out.println System.out System System.out "" 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;
			for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			}
			System.out.println("");
		} 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;
			for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			}
			System.out.println("");
		} {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j+1] = A[j];
				j--;
			}
			A[j+1] = v;
			for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			}
			System.out.println("");
		} 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 for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			} int k=0; int k=0; k 0 k<N k N k++ k++ k {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			} {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			} System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " "))) System.out.print System.out System System.out String.format("%d%s", A[k], (k==N-1 ? "" : " ")) String.format String "%d%s" A[k] A k (k==N-1 ? "" : " ") k==N-1 k N-1 N 1 "" " " System.out.println("") System.out.println System.out System System.out "" int[] A A public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int A[] = new int[n];
		in.nextLine();
		String[] A_str = in.nextLine().split(" ");
		for(int i=0;i<n;i++) A[i] = Integer.parseInt(A_str[i]);

		bubble(A);
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int A[] = new int[n];
		in.nextLine();
		String[] A_str = in.nextLine().split(" ");
		for(int i=0;i<n;i++) A[i] = Integer.parseInt(A_str[i]);

		bubble(A);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int A[] = new int[n]; A new int[n] n in.nextLine() in.nextLine in String[] A_str = in.nextLine().split(" "); A_str in.nextLine().split(" ") in.nextLine().split in.nextLine() in.nextLine in " " for(int i=0;i<n;i++) A[i] = Integer.parseInt(A_str[i]); int i=0; int i=0; i 0 i<n i n i++ i++ i A[i] = Integer.parseInt(A_str[i]); A[i] = Integer.parseInt(A_str[i]) A[i] A i Integer.parseInt(A_str[i]) Integer.parseInt Integer A_str[i] A_str i bubble(A) bubble A String args[] args
import java.util.Scanner;

class Main {
	public static void bubble(int[] A) {
		int N = A.length;
        for(int k=0;k<N;k++) {
            System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
        }
		System.out.println("");
		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;
			for(int k=0;k<N;k++) {
				System.out.print(String.format("%d%s", A[k], (k==N-1 ? "" : " ")));
			}
			System.out.println("");
		}
	}
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int A[] = new int[n];
		in.nextLine();
		String[] A_str = in.nextLine().split(" ");
		for(int i=0;i<n;i++) A[i] = Integer.parseInt(A_str[i]);

		bubble(A);
	}
}