#include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> a;
void output() {
  cout << a[0];
  for (long long i = 1; i < n; i++) {
    cout << " " << a[i];
  }
  cout << endl;
}
int main() {
  cin >> n;
  a = vector<long long>(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    for (long long j = i - 1; j >= 0 && a[j] > a[j + 1]; j--) {
      swap(a[j], a[j + 1]);
    }
    output();
  }
  return 0;
}
