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

public class Main {
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		int N = scan.nextInt();
		int[] A = new int[N];

		for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		}

		(new Solve(N, A)).solve();
	}
}
class Solve {
	private final int N;
	private final int[] A;

	public Solve(final int N, final int[] A)
	{
		this.N = N;
		this.A = A;
	}

	public void solve()
	{
		int A[] = copyNumbers(N, this.A);

		printNumList(N, A);

		for(int i=1; i < N; i++)
		{
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		}
	}

	public int[] copyNumbers(final int N, final int[] A)
	{
		int[] numbers = new int[N];

		for(int i=0; i < N; i++) numbers[i] = A[i];

		return numbers;
	}

	public void printNumList(final int N, final int[] A)
	{
		StringBuilder sb = new StringBuilder();

		for(int i=0; i < N; i++)
		{
			sb.append(A[i]);
			sb.append(" ");
		}


		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}
}
class ContestScanner {
	BufferedReader reader;
	String[] line;
	int index;
	public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}

	public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	}

	public String next() throws IOException {
		return nextToken();
	}

	public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	}

	public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	}

	public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	}

	public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	}

	public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.FileInputStream; FileInputStream java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		int N = scan.nextInt();
		int[] A = new int[N];

		for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		}

		(new Solve(N, A)).solve();
	}
} Main /**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		int N = scan.nextInt();
		int[] A = new int[N];

		for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		}

		(new Solve(N, A)).solve();
	} main {
		ContestScanner scan = new ContestScanner();

		int N = scan.nextInt();
		int[] A = new int[N];

		for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		}

		(new Solve(N, A)).solve();
	} ContestScanner scan = new ContestScanner(); scan new ContestScanner() int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int[] A = new int[N]; A new int[N] N for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i < N i N i++ i++ i {
			A[i] = scan.nextInt();
		} {
			A[i] = scan.nextInt();
		} A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan (new Solve(N, A)).solve() (new Solve(N, A)).solve (new Solve(N, A)) String[] args args class Solve {
	private final int N;
	private final int[] A;

	public Solve(final int N, final int[] A)
	{
		this.N = N;
		this.A = A;
	}

	public void solve()
	{
		int A[] = copyNumbers(N, this.A);

		printNumList(N, A);

		for(int i=1; i < N; i++)
		{
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		}
	}

	public int[] copyNumbers(final int N, final int[] A)
	{
		int[] numbers = new int[N];

		for(int i=0; i < N; i++) numbers[i] = A[i];

		return numbers;
	}

	public void printNumList(final int N, final int[] A)
	{
		StringBuilder sb = new StringBuilder();

		for(int i=0; i < N; i++)
		{
			sb.append(A[i]);
			sb.append(" ");
		}


		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}
} Solve private final int N; N private final int[] A; A public Solve(final int N, final int[] A)
	{
		this.N = N;
		this.A = A;
	} Solve {
		this.N = N;
		this.A = A;
	} this.N = N this.N this this.N N this.A = A this.A this this.A A final int N N final int[] A A public void solve()
	{
		int A[] = copyNumbers(N, this.A);

		printNumList(N, A);

		for(int i=1; i < N; i++)
		{
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		}
	} solve {
		int A[] = copyNumbers(N, this.A);

		printNumList(N, A);

		for(int i=1; i < N; i++)
		{
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		}
	} int A[] = copyNumbers(N, this.A); A copyNumbers(N, this.A) copyNumbers N this.A this this.A printNumList(N, A) printNumList N A for(int i=1; i < N; i++)
		{
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		} int i=1; int i=1; i 1 i < N i N i++ i++ i {
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		} {
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		} int v = A[i]; v A[i] A i int j= i - 1; j i - 1 i 1 while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			} j >= 0 && v < A[j] j >= 0 j 0 v < A[j] v 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] = v A[j+1] A j+1 j 1 v printNumList(N, A) printNumList N A public int[] copyNumbers(final int N, final int[] A)
	{
		int[] numbers = new int[N];

		for(int i=0; i < N; i++) numbers[i] = A[i];

		return numbers;
	} copyNumbers {
		int[] numbers = new int[N];

		for(int i=0; i < N; i++) numbers[i] = A[i];

		return numbers;
	} int[] numbers = new int[N]; numbers new int[N] N for(int i=0; i < N; i++) numbers[i] = A[i]; int i=0; int i=0; i 0 i < N i N i++ i++ i numbers[i] = A[i]; numbers[i] = A[i] numbers[i] numbers i A[i] A i return numbers; numbers final int N N final int[] A A public void printNumList(final int N, final int[] A)
	{
		StringBuilder sb = new StringBuilder();

		for(int i=0; i < N; i++)
		{
			sb.append(A[i]);
			sb.append(" ");
		}


		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	} printNumList {
		StringBuilder sb = new StringBuilder();

		for(int i=0; i < N; i++)
		{
			sb.append(A[i]);
			sb.append(" ");
		}


		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i=0; i < N; i++)
		{
			sb.append(A[i]);
			sb.append(" ");
		} int i=0; int i=0; i 0 i < N i N i++ i++ i {
			sb.append(A[i]);
			sb.append(" ");
		} {
			sb.append(A[i]);
			sb.append(" ");
		} sb.append(A[i]) sb.append sb A[i] A i sb.append(" ") sb.append sb " " sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb final int N N final int[] A A class ContestScanner {
	BufferedReader reader;
	String[] line;
	int index;
	public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}

	public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	}

	public String next() throws IOException {
		return nextToken();
	}

	public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	}

	public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	}

	public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	}

	public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	}

	public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	}
} ContestScanner BufferedReader reader; reader String[] line; line int index; index public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	} ContestScanner {
		reader = new BufferedReader(new InputStreamReader(System.in));
	} reader = new BufferedReader(new InputStreamReader(System.in)) reader new BufferedReader(new InputStreamReader(System.in)) public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	} ContestScanner {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	} reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename))) reader new BufferedReader(new InputStreamReader(new FileInputStream(filename))) String filename filename public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	} nextToken {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	} if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		} line == null || index >= line.length line == null line null index >= line.length index line.length line line.length {
			line = reader.readLine().trim().split(" ");
			index = 0;
		} line = reader.readLine().trim().split(" ") line reader.readLine().trim().split(" ") reader.readLine().trim().split reader.readLine().trim() reader.readLine().trim reader.readLine() reader.readLine reader " " index = 0 index 0 return line[index++]; line[index++] line index++ index public String next() throws IOException {
		return nextToken();
	} next {
		return nextToken();
	} return nextToken(); nextToken() nextToken public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	} readLine {
		line = null;
		index = 0;

		return reader.readLine();
	} line = null line null index = 0 index 0 return reader.readLine(); reader.readLine() reader.readLine reader public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	} nextInt {
		return Integer.parseInt(nextToken());
	} return Integer.parseInt(nextToken()); Integer.parseInt(nextToken()) Integer.parseInt Integer nextToken() nextToken public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	} nextLong {
		return Long.parseLong(nextToken());
	} return Long.parseLong(nextToken()); Long.parseLong(nextToken()) Long.parseLong Long nextToken() nextToken public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	} nextDouble {
		return Double.parseDouble(nextToken());
	} return Double.parseDouble(nextToken()); Double.parseDouble(nextToken()) Double.parseDouble Double nextToken() nextToken public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	} nextIntArray {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	} int[] result = new int[N]; result new int[N] N for(int i=0; i < N; i++) result[i] = nextInt(); int i=0; int i=0; i 0 i < N i N i++ i++ i result[i] = nextInt(); result[i] = nextInt() result[i] result i nextInt() nextInt return result; result int N N public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	} nextLongArray {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	} long[] result = new long[N]; result new long[N] N for(int i=0; i < N; i++) result[i] = nextLong(); int i=0; int i=0; i 0 i < N i N i++ i++ i result[i] = nextLong(); result[i] = nextLong() result[i] result i nextLong() nextLong return result; result int N N public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	} nexDoubleArray {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	} double[] result = new double[N]; result new double[N] N for(int i=0; i < N; i++) result[i] = nextDouble(); int i=0; int i=0; i 0 i < N i N i++ i++ i result[i] = nextDouble(); result[i] = nextDouble() result[i] result i nextDouble() nextDouble return result; result int N N public class Main {
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		int N = scan.nextInt();
		int[] A = new int[N];

		for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		}

		(new Solve(N, A)).solve();
	}
} public class Main {
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		int N = scan.nextInt();
		int[] A = new int[N];

		for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		}

		(new Solve(N, A)).solve();
	}
} Main
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		int N = scan.nextInt();
		int[] A = new int[N];

		for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		}

		(new Solve(N, A)).solve();
	}
}
class Solve {
	private final int N;
	private final int[] A;

	public Solve(final int N, final int[] A)
	{
		this.N = N;
		this.A = A;
	}

	public void solve()
	{
		int A[] = copyNumbers(N, this.A);

		printNumList(N, A);

		for(int i=1; i < N; i++)
		{
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		}
	}

	public int[] copyNumbers(final int N, final int[] A)
	{
		int[] numbers = new int[N];

		for(int i=0; i < N; i++) numbers[i] = A[i];

		return numbers;
	}

	public void printNumList(final int N, final int[] A)
	{
		StringBuilder sb = new StringBuilder();

		for(int i=0; i < N; i++)
		{
			sb.append(A[i]);
			sb.append(" ");
		}


		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}
}
class ContestScanner {
	BufferedReader reader;
	String[] line;
	int index;
	public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}

	public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	}

	public String next() throws IOException {
		return nextToken();
	}

	public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	}

	public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	}

	public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	}

	public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	}

	public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	}
}