import java.util.Scanner;

public class Main {
public static void main(String args[]) {
	int x;
	int j;
	int key;
	Scanner num = new Scanner(System.in);
	x = num.nextInt();
	int a[] = new int[x];
	for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	}
	
	for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	}
    
	for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	}
}
} import java.util.Scanner; Scanner java.util public class Main {
public static void main(String args[]) {
	int x;
	int j;
	int key;
	Scanner num = new Scanner(System.in);
	x = num.nextInt();
	int a[] = new int[x];
	for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	}
	
	for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	}
    
	for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	}
}
} Main public static void main(String args[]) {
	int x;
	int j;
	int key;
	Scanner num = new Scanner(System.in);
	x = num.nextInt();
	int a[] = new int[x];
	for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	}
	
	for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	}
    
	for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	}
} main {
	int x;
	int j;
	int key;
	Scanner num = new Scanner(System.in);
	x = num.nextInt();
	int a[] = new int[x];
	for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	}
	
	for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	}
    
	for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	}
} int x; x int j; j int key; key Scanner num = new Scanner(System.in); num new Scanner(System.in) x = num.nextInt() x num.nextInt() num.nextInt num int a[] = new int[x]; a new int[x] x for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	} int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
		a[i]=num.nextInt();
	} {
		a[i]=num.nextInt();
	} a[i]=num.nextInt() a[i] a i num.nextInt() num.nextInt num for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	} 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.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	} {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	} if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n"); k<a.length-1 k a.length-1 a.length a a.length 1 System.out.printf(a[k]+" ") System.out.printf System.out System System.out a[k]+" " a[k] a k " " System.out.printf(a[k]+"\n") System.out.printf System.out System System.out a[k]+"\n" a[k] a k "\n" for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	} int i=1; int i=1; i 1 i<a.length i a.length a a.length i++ i++ i {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	} {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	} key = a[i] key a[i] a i j = i - 1 j i - 1 i 1 while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		} a[j]>key && j>=0 a[j]>key a[j] a j key j>=0 j 0 {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		} a[j+1]=a[j] a[j+1] a j+1 j 1 a[j] a j j-- j if (j<0) {
				break;
			} j<0 j 0 {
				break;
			} break; a[j+1]= key a[j+1] a j+1 j 1 key for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(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.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		} {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		} if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+""); k<a.length-1 k a.length-1 a.length a a.length 1 System.out.printf(a[k]+" ") System.out.printf System.out System System.out a[k]+" " a[k] a k " " System.out.printf(a[k]+"") System.out.printf System.out System System.out a[k]+"" a[k] a k "" System.out.println("") System.out.println System.out System System.out "" String args[] args public class Main {
public static void main(String args[]) {
	int x;
	int j;
	int key;
	Scanner num = new Scanner(System.in);
	x = num.nextInt();
	int a[] = new int[x];
	for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	}
	
	for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	}
    
	for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	}
}
} public class Main {
public static void main(String args[]) {
	int x;
	int j;
	int key;
	Scanner num = new Scanner(System.in);
	x = num.nextInt();
	int a[] = new int[x];
	for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	}
	
	for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	}
    
	for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	}
}
} Main
import java.util.Scanner;

public class Main {
public static void main(String args[]) {
	int x;
	int j;
	int key;
	Scanner num = new Scanner(System.in);
	x = num.nextInt();
	int a[] = new int[x];
	for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	}
	
	for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	}
    
	for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	}
}
}