import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			int n = Integer.parseInt( kb.readLine() );
			String[] nums = kb.readLine().split( " " );
			int len = nums.length;
			int[] A = new int[ len ];
			
			for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			}
			
			int key;
			int j;
 			for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			}

 			kb.close();
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
} import java.io.*; io.* java class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			int n = Integer.parseInt( kb.readLine() );
			String[] nums = kb.readLine().split( " " );
			int len = nums.length;
			int[] A = new int[ len ];
			
			for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			}
			
			int key;
			int j;
 			for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			}

 			kb.close();
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
} Main public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			int n = Integer.parseInt( kb.readLine() );
			String[] nums = kb.readLine().split( " " );
			int len = nums.length;
			int[] A = new int[ len ];
			
			for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			}
			
			int key;
			int j;
 			for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			}

 			kb.close();
		} catch( IOException e ) {
			System.err.println( e );
		}
	} main {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			int n = Integer.parseInt( kb.readLine() );
			String[] nums = kb.readLine().split( " " );
			int len = nums.length;
			int[] A = new int[ len ];
			
			for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			}
			
			int key;
			int j;
 			for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			}

 			kb.close();
		} catch( IOException e ) {
			System.err.println( e );
		}
	} BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) ); kb new BufferedReader( new InputStreamReader( System.in ) ) try {
			int n = Integer.parseInt( kb.readLine() );
			String[] nums = kb.readLine().split( " " );
			int len = nums.length;
			int[] A = new int[ len ];
			
			for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			}
			
			int key;
			int j;
 			for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			}

 			kb.close();
		} catch( IOException e ) {
			System.err.println( e );
		} catch( IOException e ) {
			System.err.println( e );
		} IOException e {
			System.err.println( e );
		} System.err.println( e ) System.err.println System.err System System.err e {
			int n = Integer.parseInt( kb.readLine() );
			String[] nums = kb.readLine().split( " " );
			int len = nums.length;
			int[] A = new int[ len ];
			
			for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			}
			
			int key;
			int j;
 			for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			}

 			kb.close();
		} int n = Integer.parseInt( kb.readLine() ); n Integer.parseInt( kb.readLine() ) Integer.parseInt Integer kb.readLine() kb.readLine kb String[] nums = kb.readLine().split( " " ); nums kb.readLine().split( " " ) kb.readLine().split kb.readLine() kb.readLine kb " " int len = nums.length; len nums.length nums nums.length int[] A = new int[ len ]; A new int[ len ] len for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			} int i=0; int i=0; i 0 i<len i len i++ i++ i {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			} {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			} A[i] = Integer.parseInt( nums[i] ) A[i] A i Integer.parseInt( nums[i] ) Integer.parseInt Integer nums[i] nums i System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" ) System.out.print System.out System System.out i<(len-1)? A[i]+" ": A[i]+"\n" i<(len-1) i (len-1) len 1 A[i]+" " A[i] A i " " A[i]+"\n" A[i] A i "\n" int key; key int j; j for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			} int i=1; int i=1; i 1 i<len i len i++ i++ i {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			} {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			} key = A[i] key A[i] A i j = i - 1 j i - 1 i 1 while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				} 0 <= j && key < A[j] 0 <= j 0 j key < A[j] key A[j] A j {
					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 ] = key A[ j+1 ] A j+1 j 1 key for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				} int k=0; int k=0; k 0 k<len k len k++ k++ k {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				} {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				} System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" ) System.out.print System.out System System.out k<(len-1)? A[k]+" ": A[k]+"\n" k<(len-1) k (len-1) len 1 A[k]+" " A[k] A k " " A[k]+"\n" A[k] A k "\n" kb.close() kb.close kb String[] args args
import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			int n = Integer.parseInt( kb.readLine() );
			String[] nums = kb.readLine().split( " " );
			int len = nums.length;
			int[] A = new int[ len ];
			
			for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
				System.out.print( i<(len-1)? A[i]+" ": A[i]+"\n" );
			}
			
			int key;
			int j;
 			for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			}

 			kb.close();
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
}