#include <bits/stdc++.h>
using namespace std;
int n;
int a[101];
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int m = 200;
  int r = n;
  int l = 1;
  while (l < n) {
    for (int i = l; i <= n; i++) {
      if (a[i] < m) {
        r = i;
        m = a[i];
      }
    }
    for (int i = r - 1; i >= l; i--) {
      a[i + 1] = a[i];
    }
    a[l] = m;
    if (l == r) {
      l = r + 1;
    } else {
      l = r;
    }
    m = 200;
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
