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

public class Main {
	
	void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] stringArray = br.readLine().split(" ");
		int[] lineArray = new int[N];
		for(int i = 0; i < lineArray.length; i++) {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		}
		editLine(lineArray);
		insertionSort(lineArray, N);
	}
	
	void insertionSort(int[] A, int N) {
	   for(int i = 1; i <= N - 1; 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;
	     }
	   editLine(A);
	   }
	}
	
	void editLine(int[] A) {
		for(int k = 0; k < A.length; k++) { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		}
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	
	void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] stringArray = br.readLine().split(" ");
		int[] lineArray = new int[N];
		for(int i = 0; i < lineArray.length; i++) {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		}
		editLine(lineArray);
		insertionSort(lineArray, N);
	}
	
	void insertionSort(int[] A, int N) {
	   for(int i = 1; i <= N - 1; 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;
	     }
	   editLine(A);
	   }
	}
	
	void editLine(int[] A) {
		for(int k = 0; k < A.length; k++) { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		}
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
} Main void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] stringArray = br.readLine().split(" ");
		int[] lineArray = new int[N];
		for(int i = 0; i < lineArray.length; i++) {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		}
		editLine(lineArray);
		insertionSort(lineArray, N);
	} run {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] stringArray = br.readLine().split(" ");
		int[] lineArray = new int[N];
		for(int i = 0; i < lineArray.length; i++) {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		}
		editLine(lineArray);
		insertionSort(lineArray, N);
	} 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[] stringArray = br.readLine().split(" "); stringArray br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] lineArray = new int[N]; lineArray new int[N] N for(int i = 0; i < lineArray.length; i++) {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		} int i = 0; int i = 0; i 0 i < lineArray.length i lineArray.length lineArray lineArray.length i++ i++ i {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		} {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		} lineArray[i] = Integer.parseInt(stringArray[i]) lineArray[i] lineArray i Integer.parseInt(stringArray[i]) Integer.parseInt Integer stringArray[i] stringArray i editLine(lineArray) editLine lineArray insertionSort(lineArray, N) insertionSort lineArray N void insertionSort(int[] A, int N) {
	   for(int i = 1; i <= N - 1; 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;
	     }
	   editLine(A);
	   }
	} insertionSort {
	   for(int i = 1; i <= N - 1; 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;
	     }
	   editLine(A);
	   }
	} for(int i = 1; i <= N - 1; 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;
	     }
	   editLine(A);
	   } int i = 1; int i = 1; i 1 i <= N - 1 i N - 1 N 1 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;
	     }
	   editLine(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;
	     }
	   editLine(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--;
	     	A[j+1] = v;
	     } 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] = v;
	     } 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 editLine(A) editLine A int[] A A int N N void editLine(int[] A) {
		for(int k = 0; k < A.length; k++) { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		}
	} editLine {
		for(int k = 0; k < A.length; k++) { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		}
	} for(int k = 0; k < A.length; k++) { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		} int k = 0; int k = 0; k 0 k < A.length k A.length A A.length k++ k++ k { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		} { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		} if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			} k != A.length - 1 k A.length - 1 A.length A A.length 1 {
				System.out.print(A[k] + " ");
			} System.out.print(A[k] + " ") System.out.print System.out System System.out A[k] + " " A[k] A k " " {
				System.out.println(A[k]);
			} System.out.println(A[k]) System.out.println System.out System System.out A[k] A k int[] A A public static void main(String[] args) throws IOException {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	
	void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] stringArray = br.readLine().split(" ");
		int[] lineArray = new int[N];
		for(int i = 0; i < lineArray.length; i++) {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		}
		editLine(lineArray);
		insertionSort(lineArray, N);
	}
	
	void insertionSort(int[] A, int N) {
	   for(int i = 1; i <= N - 1; 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;
	     }
	   editLine(A);
	   }
	}
	
	void editLine(int[] A) {
		for(int k = 0; k < A.length; k++) { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		}
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
} public class Main {
	
	void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] stringArray = br.readLine().split(" ");
		int[] lineArray = new int[N];
		for(int i = 0; i < lineArray.length; i++) {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		}
		editLine(lineArray);
		insertionSort(lineArray, N);
	}
	
	void insertionSort(int[] A, int N) {
	   for(int i = 1; i <= N - 1; 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;
	     }
	   editLine(A);
	   }
	}
	
	void editLine(int[] A) {
		for(int k = 0; k < A.length; k++) { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		}
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] stringArray = br.readLine().split(" ");
		int[] lineArray = new int[N];
		for(int i = 0; i < lineArray.length; i++) {
			lineArray[i] = Integer.parseInt(stringArray[i]);
		}
		editLine(lineArray);
		insertionSort(lineArray, N);
	}
	
	void insertionSort(int[] A, int N) {
	   for(int i = 1; i <= N - 1; 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;
	     }
	   editLine(A);
	   }
	}
	
	void editLine(int[] A) {
		for(int k = 0; k < A.length; k++) { 
			if(k != A.length - 1) {
				System.out.print(A[k] + " ");
			} else {
				System.out.println(A[k]);
			}
		}
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
}