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

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint();
char rch();
long long rlong();
const int mn = 15;
int a[mn];
const int mr = mn - 1;
const int ms = mn - 2;
int R[mr];
int S[ms];
int revr[mn], revs[mn];
int f[mr][1 << ms];
int g[mr][1 << ms];
int zsum[1 << ms];
inline int next_bit_perm(int v) {
  int t = v | (v - 1);
  return (t + 1) | (((~t & -~t) - 1) >> (__builtin_ctz(v) + 1));
}
void out(int sn, int z, int n) {
  int rn = n - sn;
  int ri = rn - 2;
  printf("%d\n", sn);
  vector<pair<int, int> > v;
  v.reserve(sn);
  for (int i = 0; i < sn; i++)
    if (0 == (z & (1 << i))) v.push_back(make_pair(i, ri + 1));
  for (int rx = ri; rx >= 1; rx--) {
    int bz = g[rx][z];
    ;
    int w = z ^ bz;
    for (int i = 0; i < sn; i++)
      if (w & (1 << i)) v.push_back(make_pair(i, rx));
    z = bz;
  };
  int univ = (1 << n) - 1;
  for (auto &p : v) {
    int src = revs[p.first];
    int des = revr[p.second];
    ;
    ;
    int psrc = __builtin_popcount(univ & (1 << src) - 1) + 1;
    int pdes = __builtin_popcount(univ & (1 << des) - 1) + 1;
    printf("%d %d\n", psrc, pdes);
    univ ^= 1 << src;
  }
}
void go() {
  int n = rint();
  for (int i = 0; i < n; i++) a[i] = rint();
  bool imm = true;
  for (int i = 1; i < n; i++) {
    if (a[i - 1] >= a[i]) imm = false;
  }
  if (imm) {
    printf("0\n");
    return;
  }
  for (int sn = 1; sn < (n - 1); sn++) {
    for (int s = (1 << sn) - 1; s < (1 << n); s = next_bit_perm(s)) {
      int rn = 0;
      {
        int sidx = 0;
        for (int i = 0; i < n; i++) {
          if (s & (1 << i)) {
            revs[sidx] = i;
            S[sidx++] = a[i];
          } else {
            revr[rn] = i;
            R[rn++] = a[i];
          }
        }
      }
      for (int z = 0; z < (1 << sn); z++) {
        int sum = 0;
        for (int i = 0; i < sn; i++)
          if ((1 << i) & z) sum += S[i];
        zsum[z] = sum;
      }
      {
        int cur = 0;
        f[cur][0] = R[0];
        for (int z = 1; z < (1 << sn); z++) f[cur][z] = INF;
      }
      for (int ri = 0; ri < rn - 1; ri++) {
        int cur = ri;
        int nxt = ri + 1;
        for (int z = 0; z < (1 << sn); z++) f[nxt][z] = INF;
        for (int z = 0; z < (1 << sn); z++) {
          int now = f[cur][z];
          if (now < INF) {
            int after = R[ri + 1];
            int diff = now + 1 - after;
            if (diff <= 0) {
              if (ri == rn - 2) {
                out(sn, z, n);
                return;
              } else {
                if (after < f[nxt][z]) {
                  f[nxt][z] = after;
                  g[nxt][z] = z;
                }
              }
            } else {
              for (int w = 0;
                   (w = (w - (((1 << sn) - 1) ^ z)) & (((1 << sn) - 1) ^ z));) {
                int cand = zsum[w];
                if (cand >= diff) {
                  if (ri == rn - 2) {
                    out(sn, z, n);
                    return;
                  } else {
                    int sumcand = cand + after;
                    if (sumcand < f[nxt][z | w]) {
                      f[nxt][z | w] = sumcand;
                      g[nxt][z | w] = z;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  printf("%d\n", n - 1);
  for (int i = 0; i < n - 1; i++) printf("1 2\n");
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int T = rint();
  for (int i = 0; i < T; i++) {
    go();
  }
}
static char stdinBuffer[1024];
static char *stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char *stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}