Problem: You are given a permutation of length n. Recall that the permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2, 3, 1, 5, 4] is a permutation, but [1, 2, 2] is not a permutation (2 appears twice in the array) and [1, 3, 4] is also not a permutation (n=3 but there is 4 in the array).

You can perform at most n-1 operations with the given permutation (it is possible that you don't perform any operations at all). The i-th operation allows you to swap elements of the given permutation on positions i and i+1. Each operation can be performed at most once. The operations can be performed in arbitrary order.

Your task is to find the lexicographically minimum possible permutation obtained by performing some of the given operations in some order.

You can see the definition of the lexicographical order in the notes section.

You have to answer q independent test cases.

For example, let's consider the permutation [5, 4, 1, 3, 2]. The minimum possible permutation we can obtain is [1, 5, 2, 4, 3] and we can do it in the following way:

  1. perform the second operation (swap the second and the third elements) and obtain the permutation [5, 1, 4, 3, 2]; 
  2. perform the fourth operation (swap the fourth and the fifth elements) and obtain the permutation [5, 1, 4, 2, 3]; 
  3. perform the third operation (swap the third and the fourth elements) and obtain the permutation [5, 1, 2, 4, 3]. 
  4. perform the first operation (swap the first and the second elements) and obtain the permutation [1, 5, 2, 4, 3]; 



Another example is [1, 2, 4, 3]. The minimum possible permutation we can obtain is [1, 2, 3, 4] by performing the third operation (swap the third and the fourth elements).

Input

The first line of the input contains one integer q (1 ≤ q ≤ 100) — the number of test cases. Then q test cases follow.

The first line of the test case contains one integer n (1 ≤ n ≤ 100) — the number of elements in the permutation.

The second line of the test case contains n distinct integers from 1 to n — the given permutation.

Output

For each test case, print the answer on it — the lexicograhically minimum possible permutation obtained by performing some of the given operations in some order.

Example

Input


4
5
5 4 1 3 2
4
1 2 4 3
1
1
4
4 3 2 1


Output


1 5 2 4 3 
1 2 3 4 
1 
1 4 3 2 

Note

Recall that the permutation p of length n is lexicographically less than the permutation q of length n if there is such index i ≤ n that for all j from 1 to i - 1 the condition p_j = q_j is satisfied, and p_i < q_i. For example:

  * p = [1, 3, 5, 2, 4] is less than q = [1, 3, 5, 4, 2] (such i=4 exists, that p_i < q_i and for each j < i holds p_j = q_j), 
  * p = [1, 2] is less than q = [2, 1] (such i=1 exists, that p_i < q_i and for each j < i holds p_j = q_j). 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline void printArr(vector<long long> &arr) {
  for (long long i : arr) cout << i << " ";
  cout << '\n';
}
inline void printArr(vector<long long> &arr, long long n) {
  for (long long i = 0; i < n; ++i) cout << i << " ";
  cout << '\n';
}
inline void printArr(vector<long long> &arr, long long start, long long n) {
  for (long long i = start; i < start + n; ++i) cout << i << " ";
  cout << '\n';
}
const long long M = 998244353;
vector<long long> topologicalOrder(long long V, vector<long long> adj[]) {
  vector<long long> inDegree(V, 0);
  for (long long i = 0; i < V; ++i) {
    for (long long j = 0; j < adj[i].size(); ++j) ++inDegree[adj[i][j]];
  }
  queue<long long> q;
  for (long long i = 0; i < V; ++i) {
    if (inDegree[i] == 0) q.push(i);
  }
  vector<long long> topOrder;
  while (!q.empty()) {
    long long front = q.front();
    q.pop();
    topOrder.push_back(front);
    for (long long i = 0; i < adj[front].size(); ++i) {
      --inDegree[adj[front][i]];
      if (inDegree[adj[front][i]] == 0) q.push(adj[front][i]);
    }
  }
  return topOrder;
}
long long powM(long long a, long long b, long long m) {
  long long x = 1;
  while (b > 0) {
    if (b & 1) x = (x * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return x;
}
long long mulM(long long a, long long b, long long m) {
  long long res = 0;
  a = a % m;
  while (b > 0) {
    if (b % 2 == 1) res = (res + a) % m;
    a = (a * 2) % m;
    b /= 2;
  }
  return res % m;
}
long long nCr(long long n, long long r, long long m) {
  if (n < r) return 0;
  long long res = 1, rem = 1;
  for (long long i = n - r + 1; i <= n; i++) res = (res * i) % m;
  for (long long i = 2; i <= r; i++) rem = (rem * i) % m;
  return (res * powM(rem, m - 2, m)) % m;
}
long long MInverse(long long a, long long m) {
  a = a % m;
  for (long long x = 1; x < m; ++x) {
    if ((a * x) % m == 1) return x;
  }
  return -1;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (b == 0) {
    *x = 1, *y = 0;
    return a;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b, a % b, &x1, &y1);
  *x = y1, *y = x1 - (floor(a / b) * y1);
  return gcd;
}
long long factorial(long long n) {
  if (n == 1) return 1;
  return sqrt(2 * 3.141592653589793238461 * n) *
         pow((n / 2.71828182845904523536), n);
}
vector<bool> sieve(long long n) {
  long long sqrtn = sqrt(n);
  vector<bool> is_prime(n + 1, true);
  for (long long i = 3; i <= sqrtn; i += 2) {
    if (is_prime[i]) {
      long long increment = i + i;
      for (long long j = i * i; j <= n; j += increment) is_prime[j] = false;
    }
  }
  return is_prime;
}
vector<pair<long long, long long>> primeFactors(long long n) {
  vector<pair<long long, long long>> ans;
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      long long cnt = 0;
      while (n % i == 0) n /= i, cnt++;
      if (cnt) ans.push_back({i, cnt});
    }
  }
  if (n > 1) ans.push_back({n, 1});
  return ans;
}
void factors(vector<pair<long long, long long>> primeFactors,
             vector<long long> &ans, long long cur = 0, long long curRes = 1) {
  if (cur == primeFactors.size()) {
    ans.push_back(curRes);
    return;
  }
  for (long long i = 0; i <= primeFactors[cur].second; ++i) {
    factors(primeFactors, ans, cur + 1, curRes);
    curRes *= primeFactors[cur].first;
  }
}
vector<vector<long long>> matMul(vector<vector<long long>> A,
                                 vector<vector<long long>> B) {
  vector<vector<long long>> C(A.size(), vector<long long>(B[0].size()));
  for (long long i = 0; i < A.size(); ++i) {
    for (long long j = 0; j < B[0].size(); ++j) {
      C[i][j] = 0;
      for (long long k = 0; k < B.size(); ++k)
        C[i][j] = (C[i][j] + ((A[i][k] * B[k][j]) % M)) % M;
    }
  }
  return C;
}
vector<vector<long long>> matPow(vector<vector<long long>> A, long long p) {
  if (p == 1) return A;
  if (p & 1)
    return matMul(A, matPow(A, p - 1));
  else {
    vector<vector<long long>> C = matPow(A, p / 2);
    return matMul(C, C);
  }
}
vector<long long> zFunction(string s) {
  long long n = s.size(), L = 0, R = 0;
  vector<long long> z(n);
  for (long long i = 1; i < n; ++i) {
    if (i > R) {
      L = R = i;
      while (R < n && s[R - L] == s[R]) R++;
      z[i] = R - L;
      R--;
    } else {
      long long k = i - L;
      if (z[k] < R - i + 1)
        z[i] = z[k];
      else {
        L = i;
        while (R < n && s[R - L] == s[R]) R++;
        z[i] = R - L;
        R--;
      }
    }
  }
  return z;
}
vector<long long> patterMatch(string text, string pattern) {
  string key = pattern + '$' + text;
  vector<long long> z = zFunction(key);
  vector<long long> res;
  long long m = pattern.size();
  for (long long i = m + 1; i < key.size(); ++i)
    if (z[i] == m) res.push_back(i - m - 1);
  return res;
}
vector<long long> kaden(vector<long long> &arr) {
  vector<long long> kaden(arr.size());
  kaden[0] = arr[0];
  for (long long i = 1; i < arr.size(); ++i)
    kaden[i] = max(arr[i], arr[i] + kaden[i - 1]);
  return kaden;
}
long long digitSum(long long x) {
  long long ds = 0;
  while (x) {
    ds += x % 10;
    x /= 10;
  }
  return ds;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> arr(n);
    for (long long i = 0; i < n; ++i) cin >> arr[i];
    for (long long i = 0; i < n; ++i) arr[i]--;
    long long pos = 0;
    while (pos < n) {
      long long next = min_element(arr.begin() + pos, arr.end()) - arr.begin();
      long long el = arr[next];
      arr.erase(arr.begin() + next);
      arr.insert(arr.begin() + pos, el);
      if (pos == next)
        pos = next + 1;
      else
        pos = next;
    }
    for (long long i = 0; i < n; ++i) arr[i]++;
    printArr(arr);
  }
  return 0;
}