import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

	public static void main(String[] args) {

		Input stdIn = new Input();

		int n = stdIn.getValue();
		List<Integer> values = stdIn.getLine();

		insertionSort(values, n);

		stdIn.close();
	}

	public static void insertionSort(List<Integer> values, int n) {
		StringBuilder sb2 = new StringBuilder();
		for(int k = 0; k < values.size();k++) {
			sb2.append(values.get(k) + " ");
		}
		System.out.println(sb2.delete(sb2.length()-1, sb2.length()));
		for (int i = 1; i < values.size(); i++) {
			StringBuilder sb = new StringBuilder();
			int v = values.get(i);
			int j = i - 1;
			for (; j >= 0 && values.get(j) > v; j--) {
			}
			values.remove(i);
			values.add(j+1, v);

			for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			}
			System.out.println(sb.delete(sb.length()-1, sb.length()));
		}
	}
}

class Input {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public Input() {
	}

	public int getValue() {
		int n = 0;
		try {
			n = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		}
		return n;
	}

	public List<Integer> getLine() {
		try {
			String[] s = br.readLine().trim().split(" ");
			List<Integer> ary = new ArrayList<>();
			for (int i = 0; i < s.length; i++) {
				ary.add(Integer.parseInt(s[i]));
			}
			return ary;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	public void close() {
		try {
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util class Main {

	public static void main(String[] args) {

		Input stdIn = new Input();

		int n = stdIn.getValue();
		List<Integer> values = stdIn.getLine();

		insertionSort(values, n);

		stdIn.close();
	}

	public static void insertionSort(List<Integer> values, int n) {
		StringBuilder sb2 = new StringBuilder();
		for(int k = 0; k < values.size();k++) {
			sb2.append(values.get(k) + " ");
		}
		System.out.println(sb2.delete(sb2.length()-1, sb2.length()));
		for (int i = 1; i < values.size(); i++) {
			StringBuilder sb = new StringBuilder();
			int v = values.get(i);
			int j = i - 1;
			for (; j >= 0 && values.get(j) > v; j--) {
			}
			values.remove(i);
			values.add(j+1, v);

			for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			}
			System.out.println(sb.delete(sb.length()-1, sb.length()));
		}
	}
} Main public static void main(String[] args) {

		Input stdIn = new Input();

		int n = stdIn.getValue();
		List<Integer> values = stdIn.getLine();

		insertionSort(values, n);

		stdIn.close();
	} main {

		Input stdIn = new Input();

		int n = stdIn.getValue();
		List<Integer> values = stdIn.getLine();

		insertionSort(values, n);

		stdIn.close();
	} Input stdIn = new Input(); stdIn new Input() int n = stdIn.getValue(); n stdIn.getValue() stdIn.getValue stdIn List<Integer> values = stdIn.getLine(); values stdIn.getLine() stdIn.getLine stdIn insertionSort(values, n) insertionSort values n stdIn.close() stdIn.close stdIn String[] args args public static void insertionSort(List<Integer> values, int n) {
		StringBuilder sb2 = new StringBuilder();
		for(int k = 0; k < values.size();k++) {
			sb2.append(values.get(k) + " ");
		}
		System.out.println(sb2.delete(sb2.length()-1, sb2.length()));
		for (int i = 1; i < values.size(); i++) {
			StringBuilder sb = new StringBuilder();
			int v = values.get(i);
			int j = i - 1;
			for (; j >= 0 && values.get(j) > v; j--) {
			}
			values.remove(i);
			values.add(j+1, v);

			for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			}
			System.out.println(sb.delete(sb.length()-1, sb.length()));
		}
	} insertionSort {
		StringBuilder sb2 = new StringBuilder();
		for(int k = 0; k < values.size();k++) {
			sb2.append(values.get(k) + " ");
		}
		System.out.println(sb2.delete(sb2.length()-1, sb2.length()));
		for (int i = 1; i < values.size(); i++) {
			StringBuilder sb = new StringBuilder();
			int v = values.get(i);
			int j = i - 1;
			for (; j >= 0 && values.get(j) > v; j--) {
			}
			values.remove(i);
			values.add(j+1, v);

			for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			}
			System.out.println(sb.delete(sb.length()-1, sb.length()));
		}
	} StringBuilder sb2 = new StringBuilder(); sb2 new StringBuilder() for(int k = 0; k < values.size();k++) {
			sb2.append(values.get(k) + " ");
		} int k = 0; int k = 0; k 0 k < values.size() k values.size() values.size values k++ k++ k {
			sb2.append(values.get(k) + " ");
		} {
			sb2.append(values.get(k) + " ");
		} sb2.append(values.get(k) + " ") sb2.append sb2 values.get(k) + " " values.get(k) values.get values k " " System.out.println(sb2.delete(sb2.length()-1, sb2.length())) System.out.println System.out System System.out sb2.delete(sb2.length()-1, sb2.length()) sb2.delete sb2 sb2.length()-1 sb2.length() sb2.length sb2 1 sb2.length() sb2.length sb2 for (int i = 1; i < values.size(); i++) {
			StringBuilder sb = new StringBuilder();
			int v = values.get(i);
			int j = i - 1;
			for (; j >= 0 && values.get(j) > v; j--) {
			}
			values.remove(i);
			values.add(j+1, v);

			for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			}
			System.out.println(sb.delete(sb.length()-1, sb.length()));
		} int i = 1; int i = 1; i 1 i < values.size() i values.size() values.size values i++ i++ i {
			StringBuilder sb = new StringBuilder();
			int v = values.get(i);
			int j = i - 1;
			for (; j >= 0 && values.get(j) > v; j--) {
			}
			values.remove(i);
			values.add(j+1, v);

			for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			}
			System.out.println(sb.delete(sb.length()-1, sb.length()));
		} {
			StringBuilder sb = new StringBuilder();
			int v = values.get(i);
			int j = i - 1;
			for (; j >= 0 && values.get(j) > v; j--) {
			}
			values.remove(i);
			values.add(j+1, v);

			for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			}
			System.out.println(sb.delete(sb.length()-1, sb.length()));
		} StringBuilder sb = new StringBuilder(); sb new StringBuilder() int v = values.get(i); v values.get(i) values.get values i int j = i - 1; j i - 1 i 1 for (; j >= 0 && values.get(j) > v; j--) {
			} ; j >= 0 && values.get(j) > v j >= 0 j 0 values.get(j) > v values.get(j) values.get values j v j-- j-- j {
			} {
			} values.remove(i) values.remove values i values.add(j+1, v) values.add values j+1 j 1 v for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			} int k = 0; int k = 0; k 0 k < values.size() k values.size() values.size values k++ k++ k {
				sb.append(values.get(k) + " ");
			} {
				sb.append(values.get(k) + " ");
			} sb.append(values.get(k) + " ") sb.append sb values.get(k) + " " values.get(k) values.get values k " " System.out.println(sb.delete(sb.length()-1, sb.length())) System.out.println System.out System System.out sb.delete(sb.length()-1, sb.length()) sb.delete sb sb.length()-1 sb.length() sb.length sb 1 sb.length() sb.length sb List<Integer> values values int n n class Input {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public Input() {
	}

	public int getValue() {
		int n = 0;
		try {
			n = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		}
		return n;
	}

	public List<Integer> getLine() {
		try {
			String[] s = br.readLine().trim().split(" ");
			List<Integer> ary = new ArrayList<>();
			for (int i = 0; i < s.length; i++) {
				ary.add(Integer.parseInt(s[i]));
			}
			return ary;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	public void close() {
		try {
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} Input BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) public Input() {
	} Input {
	} public int getValue() {
		int n = 0;
		try {
			n = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		}
		return n;
	} getValue {
		int n = 0;
		try {
			n = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		}
		return n;
	} int n = 0; n 0 try {
			n = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			n = Integer.parseInt(br.readLine());
		} n = Integer.parseInt(br.readLine()) n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br return n; n public List<Integer> getLine() {
		try {
			String[] s = br.readLine().trim().split(" ");
			List<Integer> ary = new ArrayList<>();
			for (int i = 0; i < s.length; i++) {
				ary.add(Integer.parseInt(s[i]));
			}
			return ary;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	} getLine {
		try {
			String[] s = br.readLine().trim().split(" ");
			List<Integer> ary = new ArrayList<>();
			for (int i = 0; i < s.length; i++) {
				ary.add(Integer.parseInt(s[i]));
			}
			return ary;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	} try {
			String[] s = br.readLine().trim().split(" ");
			List<Integer> ary = new ArrayList<>();
			for (int i = 0; i < s.length; i++) {
				ary.add(Integer.parseInt(s[i]));
			}
			return ary;
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			String[] s = br.readLine().trim().split(" ");
			List<Integer> ary = new ArrayList<>();
			for (int i = 0; i < s.length; i++) {
				ary.add(Integer.parseInt(s[i]));
			}
			return ary;
		} String[] s = br.readLine().trim().split(" "); s br.readLine().trim().split(" ") br.readLine().trim().split br.readLine().trim() br.readLine().trim br.readLine() br.readLine br " " List<Integer> ary = new ArrayList<>(); ary new ArrayList<>() for (int i = 0; i < s.length; i++) {
				ary.add(Integer.parseInt(s[i]));
			} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
				ary.add(Integer.parseInt(s[i]));
			} {
				ary.add(Integer.parseInt(s[i]));
			} ary.add(Integer.parseInt(s[i])) ary.add ary Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i return ary; ary return null; null public void close() {
		try {
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	} close {
		try {
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	} try {
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			br.close();
		} br.close() br.close br
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

	public static void main(String[] args) {

		Input stdIn = new Input();

		int n = stdIn.getValue();
		List<Integer> values = stdIn.getLine();

		insertionSort(values, n);

		stdIn.close();
	}

	public static void insertionSort(List<Integer> values, int n) {
		StringBuilder sb2 = new StringBuilder();
		for(int k = 0; k < values.size();k++) {
			sb2.append(values.get(k) + " ");
		}
		System.out.println(sb2.delete(sb2.length()-1, sb2.length()));
		for (int i = 1; i < values.size(); i++) {
			StringBuilder sb = new StringBuilder();
			int v = values.get(i);
			int j = i - 1;
			for (; j >= 0 && values.get(j) > v; j--) {
			}
			values.remove(i);
			values.add(j+1, v);

			for(int k = 0; k < values.size();k++) {
				sb.append(values.get(k) + " ");
			}
			System.out.println(sb.delete(sb.length()-1, sb.length()));
		}
	}
}

class Input {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public Input() {
	}

	public int getValue() {
		int n = 0;
		try {
			n = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		}
		return n;
	}

	public List<Integer> getLine() {
		try {
			String[] s = br.readLine().trim().split(" ");
			List<Integer> ary = new ArrayList<>();
			for (int i = 0; i < s.length; i++) {
				ary.add(Integer.parseInt(s[i]));
			}
			return ary;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	public void close() {
		try {
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}