import java.util.Scanner;
public class Main {
	
	public static void sort(int n, int [] arr) {
		
		int j;
		
		for(int t = 0; t < n; t++) {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		}
		
		System.out.println("");
		
		for(int i = 1; i < n; i++) {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		}
	}
	
	
	public static void main(String [] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int [] arr = new int [n];
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		sort(n, arr);
		
		
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	
	public static void sort(int n, int [] arr) {
		
		int j;
		
		for(int t = 0; t < n; t++) {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		}
		
		System.out.println("");
		
		for(int i = 1; i < n; i++) {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		}
	}
	
	
	public static void main(String [] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int [] arr = new int [n];
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		sort(n, arr);
		
		
	}
} Main public static void sort(int n, int [] arr) {
		
		int j;
		
		for(int t = 0; t < n; t++) {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		}
		
		System.out.println("");
		
		for(int i = 1; i < n; i++) {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		}
	} sort {
		
		int j;
		
		for(int t = 0; t < n; t++) {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		}
		
		System.out.println("");
		
		for(int i = 1; i < n; i++) {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		}
	} int j; j for(int t = 0; t < n; t++) {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		} int t = 0; int t = 0; t 0 t < n t n t++ t++ t {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		} {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		} System.out.print(arr[t]) System.out.print System.out System System.out arr[t] arr t if(t < n - 1) {
				System.out.print(" ");
			} t < n - 1 t n - 1 n 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println("") System.out.println System.out System System.out "" for(int i = 1; i < n; i++) {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		} {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		} int key = arr[i]; key arr[i] arr i j = i - 1 j i - 1 i 1 while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			} j >= 0 && arr[j] > key j >= 0 j 0 arr[j] > key arr[j] arr j key {
				
				arr[j + 1] = arr[j];
				j--;
			} arr[j + 1] = arr[j] arr[j + 1] arr j + 1 j 1 arr[j] arr j j-- j arr[j + 1] = key arr[j + 1] arr j + 1 j 1 key for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			} int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			} {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			} System.out.print(arr[k]) System.out.print System.out System System.out arr[k] arr k if(k < n - 1) {
					System.out.print(" ");
				} k < n - 1 k n - 1 n 1 {
					System.out.print(" ");
				} System.out.print(" ") System.out.print System.out System System.out " " System.out.println("") System.out.println System.out System System.out "" int n n int [] arr arr public static void main(String [] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int [] arr = new int [n];
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		sort(n, arr);
		
		
	} main {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int [] arr = new int [n];
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		sort(n, arr);
		
		
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int [] arr = new int [n]; arr new int [n] n for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[i] = in.nextInt();
		} {
			arr[i] = in.nextInt();
		} arr[i] = in.nextInt() arr[i] arr i in.nextInt() in.nextInt in sort(n, arr) sort n arr String [] args args public class Main {
	
	public static void sort(int n, int [] arr) {
		
		int j;
		
		for(int t = 0; t < n; t++) {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		}
		
		System.out.println("");
		
		for(int i = 1; i < n; i++) {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		}
	}
	
	
	public static void main(String [] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int [] arr = new int [n];
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		sort(n, arr);
		
		
	}
} public class Main {
	
	public static void sort(int n, int [] arr) {
		
		int j;
		
		for(int t = 0; t < n; t++) {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		}
		
		System.out.println("");
		
		for(int i = 1; i < n; i++) {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		}
	}
	
	
	public static void main(String [] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int [] arr = new int [n];
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		sort(n, arr);
		
		
	}
} Main
import java.util.Scanner;
public class Main {
	
	public static void sort(int n, int [] arr) {
		
		int j;
		
		for(int t = 0; t < n; t++) {
			System.out.print(arr[t]);
			
			if(t < n - 1) {
				System.out.print(" ");
			}
		}
		
		System.out.println("");
		
		for(int i = 1; i < n; i++) {
			
			int key = arr[i];
			j = i - 1;
			
			while(j >= 0 && arr[j] > key) {
				
				arr[j + 1] = arr[j];
				j--;
			}
			
			arr[j + 1] = key;
			
			for(int k = 0; k < n; k++) {
				System.out.print(arr[k]);
				if(k < n - 1) {
					System.out.print(" ");
				}
			}
			
			System.out.println("");
		}
	}
	
	
	public static void main(String [] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int [] arr = new int [n];
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		sort(n, arr);
		
		
	}
}

