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

public class Main {
	private final static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	
	private final static StringBuilder sortedSeq = new StringBuilder();
	private final static String lb = System.getProperty("line.separator");
	
	public static void main(String[] args) {
		int[] seq = null;
		try {
			seq = getSeqence();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		seq = insertionSort(seq);
		System.out.print(sortedSeq.toString());
	}
	
	public static int[] insertionSort(final int[] seq) {
		for (int i = 1; i < seq.length; i++) {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		}
		
		return seq;
	}
	
	public static int[] getSeqence() throws IOException {
		int n = Integer.parseInt(reader.readLine());
		String[] line = reader.readLine().split("[\\s]+");
		reader.close();
		
		int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		}
		
		return seq;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	private final static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	
	private final static StringBuilder sortedSeq = new StringBuilder();
	private final static String lb = System.getProperty("line.separator");
	
	public static void main(String[] args) {
		int[] seq = null;
		try {
			seq = getSeqence();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		seq = insertionSort(seq);
		System.out.print(sortedSeq.toString());
	}
	
	public static int[] insertionSort(final int[] seq) {
		for (int i = 1; i < seq.length; i++) {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		}
		
		return seq;
	}
	
	public static int[] getSeqence() throws IOException {
		int n = Integer.parseInt(reader.readLine());
		String[] line = reader.readLine().split("[\\s]+");
		reader.close();
		
		int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		}
		
		return seq;
	}
} Main private final static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) private final static StringBuilder sortedSeq = new StringBuilder(); sortedSeq new StringBuilder() private final static String lb = System.getProperty("line.separator"); lb System.getProperty("line.separator") System.getProperty System "line.separator" public static void main(String[] args) {
		int[] seq = null;
		try {
			seq = getSeqence();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		seq = insertionSort(seq);
		System.out.print(sortedSeq.toString());
	} main {
		int[] seq = null;
		try {
			seq = getSeqence();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		seq = insertionSort(seq);
		System.out.print(sortedSeq.toString());
	} int[] seq = null; seq null try {
			seq = getSeqence();
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			seq = getSeqence();
		} seq = getSeqence() seq getSeqence() getSeqence seq = insertionSort(seq) seq insertionSort(seq) insertionSort seq System.out.print(sortedSeq.toString()) System.out.print System.out System System.out sortedSeq.toString() sortedSeq.toString sortedSeq String[] args args public static int[] insertionSort(final int[] seq) {
		for (int i = 1; i < seq.length; i++) {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		}
		
		return seq;
	} insertionSort {
		for (int i = 1; i < seq.length; i++) {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		}
		
		return seq;
	} for (int i = 1; i < seq.length; i++) {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		} int i = 1; int i = 1; i 1 i < seq.length i seq.length seq seq.length i++ i++ i {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		} {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		} final int key = seq[i]; key seq[i] seq i int j = i-1; j i-1 i 1 while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			} 0 <= j && key < seq[j] 0 <= j 0 j key < seq[j] key seq[j] seq j {
				seq[j+1] = seq[j];
				j--;
			} seq[j+1] = seq[j] seq[j+1] seq j+1 j 1 seq[j] seq j j-- j seq[j+1] = key seq[j+1] seq j+1 j 1 key for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			} int k = 0; int k = 0; k 0 k < seq.length k seq.length seq seq.length k++ k++ k {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			} {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			} sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb) sortedSeq.append(String.valueOf(seq[k])).append sortedSeq.append(String.valueOf(seq[k])) sortedSeq.append sortedSeq String.valueOf(seq[k]) String.valueOf String seq[k] seq k k < seq.length-1 ? " " : lb k < seq.length-1 k seq.length-1 seq.length seq seq.length 1 " " lb return seq; seq final int[] seq seq public static int[] getSeqence() throws IOException {
		int n = Integer.parseInt(reader.readLine());
		String[] line = reader.readLine().split("[\\s]+");
		reader.close();
		
		int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		}
		
		return seq;
	} getSeqence {
		int n = Integer.parseInt(reader.readLine());
		String[] line = reader.readLine().split("[\\s]+");
		reader.close();
		
		int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		}
		
		return seq;
	} int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader String[] line = reader.readLine().split("[\\s]+"); line reader.readLine().split("[\\s]+") reader.readLine().split reader.readLine() reader.readLine reader "[\\s]+" reader.close() reader.close reader int[] seq = new int[n]; seq new int[n] n for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		} int i = 0; int i = 0; i 0 i < seq.length i seq.length seq seq.length i++ i++ i {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		} {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		} seq[i] = Integer.parseInt(line[i]) seq[i] seq i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb) sortedSeq.append(String.valueOf(seq[i])).append sortedSeq.append(String.valueOf(seq[i])) sortedSeq.append sortedSeq String.valueOf(seq[i]) String.valueOf String seq[i] seq i i < n-1 ? " " : lb i < n-1 i n-1 n 1 " " lb return seq; seq public class Main {
	private final static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	
	private final static StringBuilder sortedSeq = new StringBuilder();
	private final static String lb = System.getProperty("line.separator");
	
	public static void main(String[] args) {
		int[] seq = null;
		try {
			seq = getSeqence();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		seq = insertionSort(seq);
		System.out.print(sortedSeq.toString());
	}
	
	public static int[] insertionSort(final int[] seq) {
		for (int i = 1; i < seq.length; i++) {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		}
		
		return seq;
	}
	
	public static int[] getSeqence() throws IOException {
		int n = Integer.parseInt(reader.readLine());
		String[] line = reader.readLine().split("[\\s]+");
		reader.close();
		
		int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		}
		
		return seq;
	}
} public class Main {
	private final static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	
	private final static StringBuilder sortedSeq = new StringBuilder();
	private final static String lb = System.getProperty("line.separator");
	
	public static void main(String[] args) {
		int[] seq = null;
		try {
			seq = getSeqence();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		seq = insertionSort(seq);
		System.out.print(sortedSeq.toString());
	}
	
	public static int[] insertionSort(final int[] seq) {
		for (int i = 1; i < seq.length; i++) {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		}
		
		return seq;
	}
	
	public static int[] getSeqence() throws IOException {
		int n = Integer.parseInt(reader.readLine());
		String[] line = reader.readLine().split("[\\s]+");
		reader.close();
		
		int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		}
		
		return seq;
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	private final static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	
	private final static StringBuilder sortedSeq = new StringBuilder();
	private final static String lb = System.getProperty("line.separator");
	
	public static void main(String[] args) {
		int[] seq = null;
		try {
			seq = getSeqence();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		seq = insertionSort(seq);
		System.out.print(sortedSeq.toString());
	}
	
	public static int[] insertionSort(final int[] seq) {
		for (int i = 1; i < seq.length; i++) {
			final int key = seq[i];
			int j = i-1;
			while (0 <= j && key < seq[j]) {
				seq[j+1] = seq[j];
				j--;
			}
			seq[j+1] = key;
			
			for (int k = 0; k < seq.length; k++) {
				sortedSeq.append(String.valueOf(seq[k])).append(k < seq.length-1 ? " " : lb);
			}
		}
		
		return seq;
	}
	
	public static int[] getSeqence() throws IOException {
		int n = Integer.parseInt(reader.readLine());
		String[] line = reader.readLine().split("[\\s]+");
		reader.close();
		
		int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
			sortedSeq.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
		}
		
		return seq;
	}
}