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

public class Main {
	public static void main(String[] args) {
		try {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) {
		try {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
} Main public static void main(String[] args) {
		try {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	} main {
		try {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	} try {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} StringBuilder out = new StringBuilder(); out new StringBuilder() String lb = System.getProperty("line.separator"); lb System.getProperty("line.separator") System.getProperty System "line.separator" BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(in.readLine()); n Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in String[] line = in.readLine().split("[\\s]+"); line in.readLine().split("[\\s]+") in.readLine().split in.readLine() in.readLine in "[\\s]+" in.close() in.close in int[] seq = new int[n]; seq new int[n] n for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.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]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			} {
				seq[i] = Integer.parseInt(line[i]);
				out.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 out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb) out.append(String.valueOf(seq[i])).append out.append(String.valueOf(seq[i])) out.append out String.valueOf(seq[i]) String.valueOf String seq[i] seq i i < n-1 ? " " : lb i < n-1 i n-1 n 1 " " lb 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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				} int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				} {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				} out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb) out.append(String.valueOf(seq[k])).append out.append(String.valueOf(seq[k])) out.append out String.valueOf(seq[k]) String.valueOf String seq[k] seq k k < n-1 ? " " : lb k < n-1 k n-1 n 1 " " lb System.out.print(out.toString()) System.out.print System.out System System.out out.toString() out.toString out String[] args args public class Main {
	public static void main(String[] args) {
		try {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
} public class Main {
	public static void main(String[] args) {
		try {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			StringBuilder out = new StringBuilder();
			String lb = System.getProperty("line.separator");
			
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(in.readLine());
			String[] line = in.readLine().split("[\\s]+");
			in.close();
			
			int[] seq = new int[n];
			for (int i = 0; i < seq.length; i++) {
				seq[i] = Integer.parseInt(line[i]);
				out.append(String.valueOf(seq[i])).append(i < n-1 ? " " : lb);
			}
			
			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 < n; k++) {
					out.append(String.valueOf(seq[k])).append(k < n-1 ? " " : lb);
				}
			}
			System.out.print(out.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}