Problem: You are given an array a consisting of n elements. You may apply several operations (possibly zero) to it.

During each operation, you choose two indices i and j (1 ≤ i, j ≤ n; i ≠ j), increase a_j by a_i, and remove the i-th element from the array (so the indices of all elements to the right to it decrease by 1, and n also decreases by 1).

Your goal is to make the array a strictly ascending. That is, the condition a_1 < a_2 < ... < a_n should hold (where n is the resulting size of the array).

Calculate the minimum number of actions required to make the array strictly ascending.

Input

The first line contains one integer T (1 ≤ T ≤ 10000) — the number of test cases.

Each test case consists of two lines. The first line contains one integer n (1 ≤ n ≤ 15) — the number of elements in the initial array a.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^6).

It is guaranteed that: 

  * the number of test cases having n ≥ 5 is not greater than 5000; 
  * the number of test cases having n ≥ 8 is not greater than 500; 
  * the number of test cases having n ≥ 10 is not greater than 100; 
  * the number of test cases having n ≥ 11 is not greater than 50; 
  * the number of test cases having n ≥ 12 is not greater than 25; 
  * the number of test cases having n ≥ 13 is not greater than 10; 
  * the number of test cases having n ≥ 14 is not greater than 3; 
  * the number of test cases having n ≥ 15 is not greater than 1. 

Output

For each test case, print the answer as follows:

In the first line, print k — the minimum number of operations you have to perform. Then print k lines, each containing two indices i and j for the corresponding operation. Note that the numeration of elements in the array changes after removing elements from it. If there are multiple optimal sequences of operations, print any one of them.

Example

Input


4
8
2 1 3 5 1 2 4 5
15
16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1
2
3 3
14
1 2 3 4 5 6 7 8 9 10 11 12 13 14


Output


3
6 8
1 6
4 1
7
1 15
1 13
1 11
1 9
1 7
1 5
1 3
1
2 1
0

Note

In the first test case, the sequence of operations changes a as follows:

[2, 1, 3, 5, 1, 2, 4, 5] → [2, 1, 3, 5, 1, 4, 7] → [1, 3, 5, 1, 6, 7] → [2, 3, 5, 6, 7].

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            FMakeItAscending solver = new FMakeItAscending();
            int testCount = Integer.parseInt(in.next());
            for (int i = 1; i <= testCount; i++)
                solver.solve(i, in, out);
            out.close();
        }
    }

    static class FMakeItAscending {
        int inf = (int) 1e9;
        int[][][] dp = new int[16][15][1 << 15];
        int[][][] lastJ = new int[16][15][1 << 15];
        int[][][] lastS = new int[16][15][1 << 15];
        int[] a = new int[15];
        int[] sum = new int[1 << 15];
        Debug debug = new Debug(true);

        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.readInt();
            for (int i = 0; i < n; i++) {
                a[i] = in.readInt();
            }

            int mask = (1 << n) - 1;
            for (int i = 1; i <= n; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k <= mask; k++) {
                        dp[i][j][k] = -1;
                    }
                }
            }

            sum[0] = 0;
            for (int i = 1; i <= mask; i++) {
                int log = CachedLog2.floorLog(Integer.lowestOneBit(i));
                sum[i] = sum[i - (1 << log)] + a[log];
            }

            int ansI = -1;
            int ansJ = -1;

            for (int i = n; i >= 1 && ansI == -1; i--) {
                for (int j = 0; j < n && ansI == -1; j++) {
                    if (dp(i, j, mask - (1 << j)) == inf) {
                        continue;
                    }
                    ansI = i;
                    ansJ = j;
                }
            }

            out.println(n - ansI);
            int s = mask - (1 << ansJ);
            IntegerBIT bit = new IntegerBIT(n);
            for (int i = 1; i <= n; i++) {
                bit.update(i, 1);
            }
            while (ansI > 0) {
                int ls = lastS[ansI][ansJ][s];
                int lj = lastJ[ansI][ansJ][s];
                int x = s - ls;
                if (ansI > 1) {
                    x -= (1 << lj);
                }
                if (s < 0) {
                    throw new RuntimeException();
                }
                debug.debug("j", ansJ);
                debug.debug("s", Integer.toString(s, 2));
                for (int i = 0; i < n; i++) {
                    if (Bits.bitAt(x, i) == 0) {
                        continue;
                    }
                    out.append(bit.query(i + 1)).append(' ').append(bit.query(ansJ + 1)).println();
                    bit.update(i + 1, -1);
                }
                s = ls;
                ansJ = lj;
                ansI--;
            }
        }

        public int dp(int i, int j, int k) {
            if (i == 0) {
                return k == 0 ? 0 : inf;
            }
            if (dp[i][j][k] == -1) {
                dp[i][j][k] = inf;
                lastJ[i][j][k] = -1;
                lastS[i][j][k] = -1;
                if (CachedBitCount.bitCount(k) + 1 < i || Bits.bitAt(k, j) == 1) {
                    return dp[i][j][k];
                }
                if (i == 1) {
                    lastS[i][j][k] = 0;
                    lastJ[i][j][k] = 0;
                    return dp[i][j][k] = sum[k + (1 << j)];
                }
                if (j == 0) {
                    return dp[i][j][k];
                }
                for (int t = i - 2; t < j; t++) {
                    if (Bits.bitAt(k, t) == 0) {
                        continue;
                    }
                    int remain = k - (1 << t);
                    for (int x = remain; ; x = (x - 1) & remain) {
                        int s = sum[(remain - x) | (1 << j)];
                        if (!(s >= dp[i][j][k] || dp(i - 1, t, x) >= s)) {
                            dp[i][j][k] = s;
                            lastJ[i][j][k] = t;
                            lastS[i][j][k] = x;
                        }
                        if (x == 0) {
                            break;
                        }
                    }
                }
            }
            return dp[i][j][k];
        }

    }

    static class Debug {
        private boolean offline;
        private PrintStream out = System.err;

        public Debug(boolean enable) {
            offline = enable && System.getSecurityManager() == null;
        }

        public Debug debug(String name, int x) {
            if (offline) {
                debug(name, "" + x);
            }
            return this;
        }

        public Debug debug(String name, String x) {
            if (offline) {
                out.printf("%s=%s", name, x);
                out.println();
            }
            return this;
        }

    }

    static class FastInput {
        private final InputStream is;
        private StringBuilder defaultStringBuf = new StringBuilder(1 << 13);
        private byte[] buf = new byte[1 << 20];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public String next() {
            return readString();
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

        public String readString(StringBuilder builder) {
            skipBlank();

            while (next > 32) {
                builder.append((char) next);
                next = read();
            }

            return builder.toString();
        }

        public String readString() {
            defaultStringBuf.setLength(0);
            return readString(defaultStringBuf);
        }

    }

    static class Bits {
        private Bits() {
        }

        public static int bitAt(int x, int i) {
            return (x >>> i) & 1;
        }

    }

    static class CachedLog2 {
        private static final int BITS = 16;
        private static final int LIMIT = 1 << BITS;
        private static final byte[] CACHE = new byte[LIMIT];

        static {
            int b = 0;
            for (int i = 0; i < LIMIT; i++) {
                while ((1 << (b + 1)) <= i) {
                    b++;
                }
                CACHE[i] = (byte) b;
            }
        }

        public static int floorLog(int x) {
            return x < LIMIT ? CACHE[x] : (BITS + CACHE[x >>> BITS]);
        }

    }

    static class CachedBitCount {
        private static final int BITS = 16;
        private static final int LIMIT = 1 << BITS;
        private static final int MASK = LIMIT - 1;
        private static final byte[] CACHE = new byte[LIMIT];

        static {
            for (int i = 1; i < LIMIT; i++) {
                CACHE[i] = (byte) (CACHE[i - (i & -i)] + 1);
            }
        }

        public static int bitCount(int x) {
            return CACHE[x & MASK] + CACHE[(x >>> 16) & MASK];
        }

    }

    static class IntegerBIT {
        private int[] data;
        private int n;

        public IntegerBIT(int n) {
            this.n = n;
            data = new int[n + 1];
        }

        public int query(int i) {
            int sum = 0;
            for (; i > 0; i -= i & -i) {
                sum += data[i];
            }
            return sum;
        }

        public void update(int i, int mod) {
            if (i <= 0) {
                return;
            }
            for (; i <= n; i += i & -i) {
                data[i] += mod;
            }
        }

        public String toString() {
            StringBuilder builder = new StringBuilder();
            for (int i = 1; i <= n; i++) {
                builder.append(query(i) - query(i - 1)).append(' ');
            }
            return builder.toString();
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private StringBuilder cache = new StringBuilder(10 << 20);
        private final Writer os;

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput append(int c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(int c) {
            return append(c).println();
        }

        public FastOutput println() {
            cache.append(System.lineSeparator());
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }
}