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>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vpdd = vector<pdd>;
template <typename T>
void ckmin(T& a, const T& b) {
  a = min(a, b);
}
template <typename T>
void ckmax(T& a, const T& b) {
  a = max(a, b);
}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
namespace __input {
template <class T1, class T2>
void re(pair<T1, T2>& p);
template <class T>
void re(vector<T>& a);
template <class T, size_t SZ>
void re(array<T, SZ>& a);
template <class T>
void re(T& x) {
  cin >> x;
}
void re(double& x) {
  string t;
  re(t);
  x = stod(t);
}
template <class Arg, class... Args>
void re(Arg& first, Args&... rest) {
  re(first);
  re(rest...);
}
template <class T1, class T2>
void re(pair<T1, T2>& p) {
  re(p.first, p.second);
}
template <class T>
void re(vector<T>& a) {
  for (int i = 0; i < (int((a).size())); i++) re(a[i]);
}
template <class T, size_t SZ>
void re(array<T, SZ>& a) {
  for (int i = 0; i < (SZ); i++) re(a[i]);
}
}  // namespace __input
using namespace __input;
namespace __output {
template <class T1, class T2>
void pr(const pair<T1, T2>& x);
template <class T, size_t SZ>
void pr(const array<T, SZ>& x);
template <class T>
void pr(const vector<T>& x);
template <class T>
void pr(const set<T>& x);
template <class T1, class T2>
void pr(const map<T1, T2>& x);
template <class T>
void pr(const T& x) {
  cout << x;
}
template <class Arg, class... Args>
void pr(const Arg& first, const Args&... rest) {
  pr(first);
  pr(rest...);
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x) {
  pr("{", x.first, ", ", x.second, "}");
}
template <class T, bool pretty = true>
void prContain(const T& x) {
  if (pretty) pr("{");
  bool fst = 1;
  for (const auto& a : x) pr(!fst ? pretty ? ", " : " " : "", a), fst = 0;
  if (pretty) pr("}");
}
template <class T>
void pc(const T& x) {
  prContain<T, false>(x);
  pr("\n");
}
template <class T, size_t SZ>
void pr(const array<T, SZ>& x) {
  prContain(x);
}
template <class T>
void pr(const vector<T>& x) {
  prContain(x);
}
template <class T>
void pr(const set<T>& x) {
  prContain(x);
}
template <class T1, class T2>
void pr(const map<T1, T2>& x) {
  prContain(x);
}
void ps() { pr("\n"); }
template <class Arg>
void ps(const Arg& first) {
  pr(first);
  ps();
}
template <class Arg, class... Args>
void ps(const Arg& first, const Args&... rest) {
  pr(first, " ");
  ps(rest...);
}
}  // namespace __output
using namespace __output;
namespace __algorithm {
template <typename T>
void dedup(vector<T>& v) {
  sort((v).begin(), (v).end());
  v.erase(unique((v).begin(), (v).end()), v.end());
}
template <typename T>
typename vector<T>::const_iterator find(const vector<T>& v, const T& x) {
  auto it = lower_bound((v).begin(), (v).end(), x);
  return it != v.end() && *it == x ? it : v.end();
}
template <typename T>
size_t index(const vector<T>& v, const T& x) {
  auto it = find(v, x);
  assert(it != v.end() && *it == x);
  return it - v.begin();
}
template <typename T1, typename T2>
typename vector<pair<T1, T2>>::iterator lower_bound(
    const vector<pair<T1, T2>>& v, const T1& x) {
  return lower_bound(
      (v).begin(), (v).end(), x,
      [](pair<T1, T2> a, pair<T1, T2> b) { return a.first < b.first; });
}
template <typename T1, typename T2>
typename vector<pair<T1, T2>>::iterator upper_bound(
    const vector<pair<T1, T2>>& v, const T1& x) {
  return upper_bound(
      (v).begin(), (v).end(), x,
      [](pair<T1, T2> a, pair<T1, T2> b) { return a.first < b.first; });
}
}  // namespace __algorithm
using namespace __algorithm;
struct __monostate {
  friend istream& operator>>(istream& is,
                             const __attribute__((unused)) __monostate& ms) {
    return is;
  }
  friend ostream& operator<<(ostream& os,
                             const __attribute__((unused)) __monostate& ms) {
    return os;
  }
} ms;
namespace __io {
void setIn(string second) { freopen(second.c_str(), "r", stdin); }
void setOut(string second) { freopen(second.c_str(), "w", stdout); }
void setIO(string second = "") {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << setprecision(15);
  if (int((second).size())) {
    setIn(second + ".in"), setOut(second + ".out");
  }
}
}  // namespace __io
using namespace __io;
const int MAXN = 15;
int mask[1 << MAXN];
struct state {
  int lval, step;
  friend bool operator<(const state& a, const state& b) {
    return a.lval < b.lval;
  }
};
int dp[MAXN + 1][MAXN + 1][1 << MAXN];
int step[MAXN + 1][MAXN + 1][1 << MAXN];
void solve() {
  int N;
  re(N);
  vi items(N);
  re(items);
  for (int bit = 0; bit < (N); bit++)
    for (int i = 0; i < (1 << bit); i++)
      mask[i + (1 << bit)] = mask[i] + items[bit];
  const int INF = 1e9;
  {
    for (int inx = 0; inx < (N + 1); inx++)
      for (int moved = 0; moved < (N + 1); moved++)
        for (int used = 0; used < (1 << N); used++) dp[inx][moved][used] = INF;
    dp[0][0][0] = 0;
  }
  for (int inx = 0; inx < (N); inx++) {
    for (int moved = 0; moved < (N + 1); moved++) {
      for (int used = 0; used < (1 << N); used++) {
        int lval = dp[inx][moved][used];
        if (lval == INF) continue;
        if (lval < dp[inx + 1][moved][used]) {
          dp[inx + 1][moved][used] = lval;
          step[inx + 1][moved][used] = -1;
        }
        if (!(used & (1 << inx))) {
          int avail = ((1 << N) - 1) ^ used ^ (1 << inx);
          for (int _put = avail;; _put = (_put - 1) & avail) {
            if (int put = _put | (1 << inx); mask[put] > lval) {
              int n_moved = moved + __builtin_popcount(put) - 1;
              int n_used = used | put;
              if (mask[put] < dp[inx + 1][n_moved][n_used]) {
                dp[inx + 1][n_moved][n_used] = mask[put];
                step[inx + 1][n_moved][n_used] = put;
              }
            }
            if (_put == 0) break;
          }
        }
      }
    }
  }
  int used = (1 << N) - 1;
  int moved = 0;
  while (moved < N && dp[N][moved][used] == INF) moved++;
  vpii moves;
  vi alive(N, 1);
  auto get = [&](int i) {
    int adjusted = 0;
    for (int j = 0; j < (i); j++)
      if (alive[j]) adjusted++;
    return adjusted;
  };
  for (int inx = (N)-1; inx >= 0; inx--) {
    int put = step[inx + 1][moved][used];
    if (put != -1) {
      used ^= put;
      moved -= __builtin_popcount(put) - 1;
      assert(put & (1 << inx));
      for (int i = 0; i < (N); i++) {
        if (put & (1 << i)) {
          if (i != inx) {
            moves.emplace_back(get(i), get(inx));
            alive[i] = 0;
          }
        }
      }
    }
  }
  ps(int((moves).size()));
  for (auto& p : moves) ps(p.first + 1, p.second + 1);
}
int main() {
  setIO();
  int T;
  re(T);
  for (int t = 0; t < (T); t++) {
    solve();
  }
  return 0;
}