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

class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String SORT_LENGTH=br.readLine();
		int LENGTH=Integer.parseInt(SORT_LENGTH);
		while (true){
			try{
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			}
			catch(Exception e){
				System.exit(0);
			}
		}
	}

	public static int[] Insert_srt(int[] a){		//????????????????????????????????°??¨????????£??\
		int[] ary=a;
		for(int i=1; i<ary.length; i++){
			int v=ary[i];
			int j=i-1;

			while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1]=v;
			String ketsugou=""+ary[0];
			for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			}
			System.out.println(ketsugou);
			ketsugou="";
		}
		return ary;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String SORT_LENGTH=br.readLine();
		int LENGTH=Integer.parseInt(SORT_LENGTH);
		while (true){
			try{
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			}
			catch(Exception e){
				System.exit(0);
			}
		}
	}

	public static int[] Insert_srt(int[] a){		//????????????????????????????????°??¨????????£??\
		int[] ary=a;
		for(int i=1; i<ary.length; i++){
			int v=ary[i];
			int j=i-1;

			while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1]=v;
			String ketsugou=""+ary[0];
			for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			}
			System.out.println(ketsugou);
			ketsugou="";
		}
		return ary;
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String SORT_LENGTH=br.readLine();
		int LENGTH=Integer.parseInt(SORT_LENGTH);
		while (true){
			try{
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			}
			catch(Exception e){
				System.exit(0);
			}
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String SORT_LENGTH=br.readLine();
		int LENGTH=Integer.parseInt(SORT_LENGTH);
		while (true){
			try{
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			}
			catch(Exception e){
				System.exit(0);
			}
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String SORT_LENGTH=br.readLine(); SORT_LENGTH br.readLine() br.readLine br int LENGTH=Integer.parseInt(SORT_LENGTH); LENGTH Integer.parseInt(SORT_LENGTH) Integer.parseInt Integer SORT_LENGTH while (true){
			try{
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			}
			catch(Exception e){
				System.exit(0);
			}
		} true {
			try{
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			}
			catch(Exception e){
				System.exit(0);
			}
		} try{
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			}
			catch(Exception e){
				System.exit(0);
			} catch(Exception e){
				System.exit(0);
			} Exception e {
				System.exit(0);
			} System.exit(0) System.exit System 0 {
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			} int[] hako=new int[LENGTH]; hako new int[LENGTH] LENGTH String obj=br.readLine(); obj br.readLine() br.readLine br StringTokenizer st=new StringTokenizer(obj," "); st new StringTokenizer(obj," ") int i=0; i 0 while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     } st.hasMoreTokens() st.hasMoreTokens st {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     } hako[i]=Integer.parseInt(st.nextToken()) hako[i] hako i Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st i++ i i=0 i 0 String nakami=""+hako[0]; nakami ""+hako[0] "" hako[0] hako 0 for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					} int s=1; int s=1; s 1 s<hako.length s hako.length hako hako.length s++ s++ s {
						nakami=nakami+" "+hako[s];
					} {
						nakami=nakami+" "+hako[s];
					} nakami=nakami+" "+hako[s] nakami nakami+" "+hako[s] nakami+" "+hako[s] nakami " " hako[s] hako s System.out.println(nakami) System.out.println System.out System System.out nakami nakami="" nakami "" int[] res=Insert_srt(hako); res Insert_srt(hako) Insert_srt hako String[] args args public static int[] Insert_srt(int[] a){		//????????????????????????????????°??¨????????£??\
		int[] ary=a;
		for(int i=1; i<ary.length; i++){
			int v=ary[i];
			int j=i-1;

			while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1]=v;
			String ketsugou=""+ary[0];
			for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			}
			System.out.println(ketsugou);
			ketsugou="";
		}
		return ary;
	} Insert_srt {		//????????????????????????????????°??¨????????£??\
		int[] ary=a;
		for(int i=1; i<ary.length; i++){
			int v=ary[i];
			int j=i-1;

			while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1]=v;
			String ketsugou=""+ary[0];
			for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			}
			System.out.println(ketsugou);
			ketsugou="";
		}
		return ary;
	} int[] ary=a; ary a for(int i=1; i<ary.length; i++){
			int v=ary[i];
			int j=i-1;

			while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1]=v;
			String ketsugou=""+ary[0];
			for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			}
			System.out.println(ketsugou);
			ketsugou="";
		} int i=1; int i=1; i 1 i<ary.length i ary.length ary ary.length i++ i++ i {
			int v=ary[i];
			int j=i-1;

			while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1]=v;
			String ketsugou=""+ary[0];
			for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			}
			System.out.println(ketsugou);
			ketsugou="";
		} {
			int v=ary[i];
			int j=i-1;

			while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1]=v;
			String ketsugou=""+ary[0];
			for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			}
			System.out.println(ketsugou);
			ketsugou="";
		} int v=ary[i]; v ary[i] ary i int j=i-1; j i-1 i 1 while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			} j>=0 && ary[j]>v j>=0 j 0 ary[j]>v ary[j] ary j v {
				ary[j+1] = ary[j];
				j--;
			} ary[j+1] = ary[j] ary[j+1] ary j+1 j 1 ary[j] ary j j-- j ary[j+1]=v ary[j+1] ary j+1 j 1 v String ketsugou=""+ary[0]; ketsugou ""+ary[0] "" ary[0] ary 0 for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			} int s=1; int s=1; s 1 s<ary.length s ary.length ary ary.length s++ s++ s {
				ketsugou=ketsugou+" "+ary[s];
			} {
				ketsugou=ketsugou+" "+ary[s];
			} ketsugou=ketsugou+" "+ary[s] ketsugou ketsugou+" "+ary[s] ketsugou+" "+ary[s] ketsugou " " ary[s] ary s System.out.println(ketsugou) System.out.println System.out System System.out ketsugou ketsugou="" ketsugou "" return ary; ary int[] a a
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String SORT_LENGTH=br.readLine();
		int LENGTH=Integer.parseInt(SORT_LENGTH);
		while (true){
			try{
				int[] hako=new int[LENGTH];
				String obj=br.readLine();

				StringTokenizer st=new StringTokenizer(obj," ");
				int i=0;
			     while (st.hasMoreTokens()) {
			    	 hako[i]=Integer.parseInt(st.nextToken());
			    	 i++;
			     }i=0;

			     String nakami=""+hako[0];
					for(int s=1; s<hako.length; s++){
						nakami=nakami+" "+hako[s];
					}
					System.out.println(nakami);
					nakami="";

				int[] res=Insert_srt(hako);
			}
			catch(Exception e){
				System.exit(0);
			}
		}
	}

	public static int[] Insert_srt(int[] a){		//????????????????????????????????°??¨????????£??\
		int[] ary=a;
		for(int i=1; i<ary.length; i++){
			int v=ary[i];
			int j=i-1;

			while(j>=0 && ary[j]>v){
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1]=v;
			String ketsugou=""+ary[0];
			for(int s=1; s<ary.length; s++){
				ketsugou=ketsugou+" "+ary[s];
			}
			System.out.println(ketsugou);
			ketsugou="";
		}
		return ary;
	}
}