import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int N = Integer.parseInt(br.readLine());
	    String[] line = br.readLine().split(" ");
	    int[] data = new int[line.length];

	    for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    }

	    StringBuilder sb = new StringBuilder();
	    sb.append(disp(data)).append("\n");

	    for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    }
	    System.out.print(sb.toString());
	}

	public static String disp(int[] data) {
	    StringBuilder sb = new StringBuilder();
    	for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	}
	    return sb.toString();
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int N = Integer.parseInt(br.readLine());
	    String[] line = br.readLine().split(" ");
	    int[] data = new int[line.length];

	    for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    }

	    StringBuilder sb = new StringBuilder();
	    sb.append(disp(data)).append("\n");

	    for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    }
	    System.out.print(sb.toString());
	}

	public static String disp(int[] data) {
	    StringBuilder sb = new StringBuilder();
    	for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	}
	    return sb.toString();
	}
} Main public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int N = Integer.parseInt(br.readLine());
	    String[] line = br.readLine().split(" ");
	    int[] data = new int[line.length];

	    for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    }

	    StringBuilder sb = new StringBuilder();
	    sb.append(disp(data)).append("\n");

	    for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    }
	    System.out.print(sb.toString());
	} main {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int N = Integer.parseInt(br.readLine());
	    String[] line = br.readLine().split(" ");
	    int[] data = new int[line.length];

	    for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    }

	    StringBuilder sb = new StringBuilder();
	    sb.append(disp(data)).append("\n");

	    for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    }
	    System.out.print(sb.toString());
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] data = new int[line.length]; data new int[line.length] line.length line line.length for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    } int i = 0; int i = 0; i 0 i < line.length i line.length line line.length i++ i++ i {
	    	data[i] = Integer.parseInt(line[i]);
	    } {
	    	data[i] = Integer.parseInt(line[i]);
	    } data[i] = Integer.parseInt(line[i]) data[i] data i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(disp(data)).append("\n") sb.append(disp(data)).append sb.append(disp(data)) sb.append sb disp(data) disp data "\n" for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    } int i = 1; int i = 1; i 1 i <= N - 1 i N - 1 N 1 i++ i++ i {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    } {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    } int v = data[i]; v data[i] data i int j = i - 1; j i - 1 i 1 while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	} j >= 0 && data[j] > v j >= 0 j 0 data[j] > v data[j] data j v {
	    		data[j + 1] = data[j];
	    		j--;
	    	} data[j + 1] = data[j] data[j + 1] data j + 1 j 1 data[j] data j j-- j data[j + 1] = v data[j + 1] data j + 1 j 1 v sb.append(disp(data)).append("\n") sb.append(disp(data)).append sb.append(disp(data)) sb.append sb disp(data) disp data "\n" System.out.print(sb.toString()) System.out.print System.out System System.out sb.toString() sb.toString sb String[] args args public static String disp(int[] data) {
	    StringBuilder sb = new StringBuilder();
    	for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	}
	    return sb.toString();
	} disp {
	    StringBuilder sb = new StringBuilder();
    	for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	}
	    return sb.toString();
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	} int k = 0; int k = 0; k 0 k < data.length k data.length data data.length k++ k++ k {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	} {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	} sb.append(data[k]) sb.append sb data[k] data k if (k != data.length - 1) {
    			sb.append(" ");
    		} k != data.length - 1 k data.length - 1 data.length data data.length 1 {
    			sb.append(" ");
    		} sb.append(" ") sb.append sb " " return sb.toString(); sb.toString() sb.toString sb int[] data data public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int N = Integer.parseInt(br.readLine());
	    String[] line = br.readLine().split(" ");
	    int[] data = new int[line.length];

	    for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    }

	    StringBuilder sb = new StringBuilder();
	    sb.append(disp(data)).append("\n");

	    for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    }
	    System.out.print(sb.toString());
	}

	public static String disp(int[] data) {
	    StringBuilder sb = new StringBuilder();
    	for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	}
	    return sb.toString();
	}
} public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int N = Integer.parseInt(br.readLine());
	    String[] line = br.readLine().split(" ");
	    int[] data = new int[line.length];

	    for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    }

	    StringBuilder sb = new StringBuilder();
	    sb.append(disp(data)).append("\n");

	    for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    }
	    System.out.print(sb.toString());
	}

	public static String disp(int[] data) {
	    StringBuilder sb = new StringBuilder();
    	for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	}
	    return sb.toString();
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int N = Integer.parseInt(br.readLine());
	    String[] line = br.readLine().split(" ");
	    int[] data = new int[line.length];

	    for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    }

	    StringBuilder sb = new StringBuilder();
	    sb.append(disp(data)).append("\n");

	    for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    }
	    System.out.print(sb.toString());
	}

	public static String disp(int[] data) {
	    StringBuilder sb = new StringBuilder();
    	for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	}
	    return sb.toString();
	}
}