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 JAVA):

Solution:
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Codeforces {

    static double Phi = (1 + Math.sqrt(5)) / 2.0;
    static int MAX = -1 >>> 1;
    static long MODL = 1_000_000_007L;
    static int MOD = 1_000_000_007;
    static void no() throws IOException {println("NO");}
    static void yes() throws IOException {println("YES");}

    static boolean testCases = true;
    static boolean DEBUG = false;

    static void main() throws Exception {
        int n = ni();
        int[] arr = nia(n);
        Set<Integer> ops = new HashSet<>();
        for(int i = 0; i < n; ++i) ops.add(i);

        int moves = n - 1;
        int fix = 1;
        while(moves > 0 && fix <= n) {
            // debug("fix now is " + fix + " and ops is " + ops.toString());
            // debug(Arrays.toString(arr));
            int indexOfFix = find(arr, ops, fix);
            if(indexOfFix == -1) {
                ++fix;
                continue;
            }
            moves = moveFix(arr, moves, ops, indexOfFix - 1);
            ++fix;
        }
        for (int i = 0; i < n; ++i) {
            print(arr[i] + " ");
        }
        println();
    }
    static int find(int[] arr, Set<Integer> ops, int find) {
        for(int i = 0; i < arr.length; ++i) {
            if(ops.contains(i)) {
                if(arr[i] == find) return i;
            }
        }
        return -1;
    }
    static int moveFix(int[] arr, int availableMoves, Set<Integer> ops, int index) {
        for(int i = index; ops.contains(i) && availableMoves > 0 && arr[i] > arr[i + 1]; --i, --availableMoves) {
            int temp = arr[i];
            arr[i] = arr[i + 1];
            arr[i + 1] = temp;
            ops.remove(i);
        }
        return availableMoves;
    }
    
    public static void main(String[] args) throws Exception {
        long startPointTime = System.currentTimeMillis();
        scannerIn = System.in;
        printerBW = new BufferedWriter(new OutputStreamWriter(System.out));
        if (DEBUG && System.getProperty("ONLINE_JUDGE") == null) {
            HABLA = true;
            debug("Debugging enabled");
        }

        int t = testCases ? ni() : 1;
        int to = t;
        while (t-- > 0) {
            debug("Case #" + (to - t) + " ---------------- ");
            main();
        }
        long endTime = System.currentTimeMillis();
        float totalProgramTime = endTime - startPointTime;
        if (HABLA)
            debug("Execution time is " + totalProgramTime + " (" + (totalProgramTime / 1000) + "s)");
        close();
    }
    
 //IO Stuff
    private static boolean HABLA = false;
    private static byte[] scannerByteBuffer = new byte[1024]; // Buffer of Bytes
    private static int scannerIndex;
    private static InputStream scannerIn;
    private static int scannerTotal;
    private static BufferedWriter printerBW;

    private static int next() throws IOException { // Scan method used to scan buf
        if (scannerTotal < 0)
            throw new InputMismatchException();
        if (scannerIndex >= scannerTotal) {
            scannerIndex = 0;
            scannerTotal = scannerIn.read(scannerByteBuffer);
            if (scannerTotal <= 0)
                return -1;
        }
        return scannerByteBuffer[scannerIndex++];
    }

    static int ni() throws IOException {
        int integer = 0;
        int n = next();
        while (isWhiteSpace(n)) // Removing startPointing whitespaces
            n = next();
        int neg = 1;
        if (n == '-') { // If Negative Sign encounters
            neg = -1;
            n = next();
        }
        while (!isWhiteSpace(n)) {
            if (n >= '0' && n <= '9') {
                integer *= 10;
                integer += n - '0';
                n = next();
            } else
                throw new InputMismatchException();
        }
        return neg * integer;
    }

    static long nl() throws IOException {
        long integer = 0;
        int n = next();
        while (isWhiteSpace(n)) // Removing startPointing whitespaces
            n = next();
        int neg = 1;
        if (n == '-') { // If Negative Sign encounters
            neg = -1;
            n = next();
        }
        while (!isWhiteSpace(n)) {
            if (n >= '0' && n <= '9') {
                integer *= 10;
                integer += n - '0';
                n = next();
            } else
                throw new InputMismatchException();
        }
        return neg * integer;
    }

    static String line() throws IOException {
        StringBuilder sb = new StringBuilder();
        int n = next();
        while (isWhiteSpace(n))
            n = next();
        while (!isNewLine(n)) {
            sb.append((char) n);
            n = next();
        }
        return sb.toString();
    }

    private static boolean isNewLine(int n) {
        return n == '\n' || n == '\r' || n == -1;
    }

    private static boolean isWhiteSpace(int n) {
        return n == ' ' || isNewLine(n) || n == '\t';
    }

    static int[] nia(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = ni();
        return array;
    }

    static long[] nla(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        long[] array = new long[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static float[] nfa(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        float[] array = new float[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static double[] nda(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static <T> void print(T str) throws IOException {
        printerBW.append(str.toString());
        if (HABLA) flush();
    }

    static <T> void println() throws IOException {
        printerBW.append('\n');
        if (HABLA) flush();
    }

    static <T> void println(T str) throws IOException {
        if (str == null) {
            printerBW.append("null\n");
        } else {
            printerBW.append(str.toString());
            printerBW.append('\n');
            if (HABLA) flush();
        }
    }

    public static final String ANSI_RESET = "\u001B[0m";
    public static final String ANSI_DEBUG = "\u001B[33m";
    static <T> void debugl(T str) throws IOException {
        if (!HABLA) return;
        if (str == null) {
            printerBW.append(ANSI_DEBUG);
            printerBW.append("null");
            printerBW.append(ANSI_RESET);
        } else {
            printerBW.append(ANSI_DEBUG);
            printerBW.append(str.toString());
            printerBW.append(ANSI_RESET);
        }
        flush();
    }

    static void debug() throws IOException {
        if (!HABLA) return;
        printerBW.append('\n');
        flush();
    }
    static <T> void debug(T str) throws IOException {
        if (!HABLA) return;
        if (str == null) {
            printerBW.append(ANSI_DEBUG);
            printerBW.append("null\n");
            printerBW.append(ANSI_RESET);
        } else {
            printerBW.append(ANSI_DEBUG);
            printerBW.append(str.toString());
            printerBW.append(ANSI_RESET);
            printerBW.append('\n');
        }
        flush();
    }

    static void flush() throws IOException {
        printerBW.flush();
    }

    static void close() {
        try {
            printerBW.close();
        } catch (IOException e) {
            System.out.println(e.toString());
        }
    }
}