import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

class Main {
	
	static class InsertionSort {
		public void insertionsort (InputReader ir) {
			
			int n = ir.nextInt();
			int array[] = new int[n];
			StringBuilder sb = new StringBuilder ();
			
			//配列入力
			for (int i = 0; i < n; i++ ) {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			}
			
			System.out.println(sb);
			sb.setLength(0);
		
			//挿入ソート
			for (int i = 1; i < n; i++) {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			}
			
			
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		InsertionSort obj = new InsertionSort ();
		obj.insertionsort (in);
	}
	
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.InputMismatchException; InputMismatchException java.util import java.util.StringTokenizer; StringTokenizer java.util class Main {
	
	static class InsertionSort {
		public void insertionsort (InputReader ir) {
			
			int n = ir.nextInt();
			int array[] = new int[n];
			StringBuilder sb = new StringBuilder ();
			
			//配列入力
			for (int i = 0; i < n; i++ ) {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			}
			
			System.out.println(sb);
			sb.setLength(0);
		
			//挿入ソート
			for (int i = 1; i < n; i++) {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			}
			
			
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		InsertionSort obj = new InsertionSort ();
		obj.insertionsort (in);
	}
	
} Main public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		InsertionSort obj = new InsertionSort ();
		obj.insertionsort (in);
	} main {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		InsertionSort obj = new InsertionSort ();
		obj.insertionsort (in);
	} InputStream inputStream = System.in; inputStream System.in System System.in InputReader in = new InputReader (inputStream); in new InputReader (inputStream) InsertionSort obj = new InsertionSort (); obj new InsertionSort () obj.insertionsort (in) obj.insertionsort obj in String[] args args static class InsertionSort {
		public void insertionsort (InputReader ir) {
			
			int n = ir.nextInt();
			int array[] = new int[n];
			StringBuilder sb = new StringBuilder ();
			
			//配列入力
			for (int i = 0; i < n; i++ ) {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			}
			
			System.out.println(sb);
			sb.setLength(0);
		
			//挿入ソート
			for (int i = 1; i < n; i++) {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			}
			
			
		}
	} InsertionSort public void insertionsort (InputReader ir) {
			
			int n = ir.nextInt();
			int array[] = new int[n];
			StringBuilder sb = new StringBuilder ();
			
			//配列入力
			for (int i = 0; i < n; i++ ) {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			}
			
			System.out.println(sb);
			sb.setLength(0);
		
			//挿入ソート
			for (int i = 1; i < n; i++) {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			}
			
			
		} insertionsort {
			
			int n = ir.nextInt();
			int array[] = new int[n];
			StringBuilder sb = new StringBuilder ();
			
			//配列入力
			for (int i = 0; i < n; i++ ) {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			}
			
			System.out.println(sb);
			sb.setLength(0);
		
			//挿入ソート
			for (int i = 1; i < n; i++) {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			}
			
			
		} int n = ir.nextInt(); n ir.nextInt() ir.nextInt ir int array[] = new int[n]; array new int[n] n StringBuilder sb = new StringBuilder (); sb new StringBuilder () for (int i = 0; i < n; i++ ) {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			} {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			} array[i] = ir.nextInt() array[i] array i ir.nextInt() ir.nextInt ir if (i != 0) sb.append(" "); i != 0 i 0 sb.append(" ") sb.append sb " " sb.append(array[i]) sb.append sb array[i] array i System.out.println(sb) System.out.println System.out System System.out sb sb.setLength(0) sb.setLength sb 0 for (int i = 1; i < n; i++) {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			} {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			} int v = array[i]; v array[i] array i int j = i - 1; j i - 1 i 1 while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				} j >= 0 && array[j] > v j >= 0 j 0 array[j] > v array[j] array j v {
					array[j + 1] = array[j];
					j--;
				} array[j + 1] = array[j] array[j + 1] array j + 1 j 1 array[j] array j j-- j array[j + 1] = v array[j + 1] array j + 1 j 1 v for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				} int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				} {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				} if (k != 0) sb.append(" "); k != 0 k 0 sb.append(" ") sb.append sb " " sb.append(array[k]) sb.append sb array[k] array k System.out.println(sb) System.out.println System.out System System.out sb sb.setLength(0) sb.setLength sb 0 InputReader ir ir static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	} InputReader BufferedReader br; br StringTokenizer st; st public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		} nextString {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		} while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            } !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            } try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                } IOException e {
	                    throw new InputMismatchException();
	                } throw new InputMismatchException(); new InputMismatchException() {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } st = new StringTokenizer(br.readLine(), " ") st new StringTokenizer(br.readLine(), " ") return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() {
			return Integer.parseInt(nextString());
		} nextInt {
			return Integer.parseInt(nextString());
		} return Integer.parseInt(nextString()); Integer.parseInt(nextString()) Integer.parseInt Integer nextString() nextString public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		} InputReader {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		} br = new BufferedReader (new InputStreamReader (inputStream)) br new BufferedReader (new InputStreamReader (inputStream)) st = new StringTokenizer ("") st new StringTokenizer ("") InputStream inputStream inputStream
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

class Main {
	
	static class InsertionSort {
		public void insertionsort (InputReader ir) {
			
			int n = ir.nextInt();
			int array[] = new int[n];
			StringBuilder sb = new StringBuilder ();
			
			//配列入力
			for (int i = 0; i < n; i++ ) {
				array[i] = ir.nextInt();
				
				if (i != 0) sb.append(" ");
				sb.append(array[i]);
			}
			
			System.out.println(sb);
			sb.setLength(0);
		
			//挿入ソート
			for (int i = 1; i < n; i++) {
				int v = array[i];
				int j = i - 1;
				
				while ( j >= 0 && array[j] > v) {
					array[j + 1] = array[j];
					j--;
				}
				array[j + 1] = v;
				
				for (int k = 0; k < n; k++ ) {
					if (k != 0) sb.append(" ");
					sb.append(array[k]);
				}
				System.out.println(sb);
				sb.setLength(0);
			}
			
			
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		InsertionSort obj = new InsertionSort ();
		obj.insertionsort (in);
	}
	
}

