#include <bits/stdc++.h>
using namespace std;
bool v[105];
int ara[105];
int main() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    int N;
    memset(v, 0, sizeof(v));
    cin >> N;
    for (int i = 0; i < N; i++) {
      cin >> ara[i];
    }
    for (int i = N - 2; i >= 0; i--) {
      if (ara[i] > ara[i + 1]) {
        swap(ara[i], ara[i + 1]);
        v[i] = 1;
      }
    }
    while (1) {
      bool b = 0;
      for (int i = 0; i < N - 1; i++) {
        if (!v[i] && ara[i] > ara[i + 1]) {
          swap(ara[i], ara[i + 1]);
          v[i] = 1;
          b = 1;
        }
      }
      if (!b) {
        break;
      }
    }
    for (int i = 0; i < N; i++) {
      cout << ara[i] << ' ';
    }
    cout << endl;
  }
}
