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>
template <typename T>
void MACRO_VAR_Scan(T& t) {
  std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First& first, Rest&... rest) {
  std::cin >> first;
  MACRO_VAR_Scan(rest...);
}
template <typename T>
void MACRO_VEC_ROW_Init(int n, T& t) {
  t.resize(n);
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Init(int n, First& first, Rest&... rest) {
  first.resize(n);
  MACRO_VEC_ROW_Init(n, rest...);
}
template <typename T>
void MACRO_VEC_ROW_Scan(int p, T& t) {
  std::cin >> t[p];
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Scan(int p, First& first, Rest&... rest) {
  std::cin >> first[p];
  MACRO_VEC_ROW_Scan(p, rest...);
}
template <typename T>
void MACRO_OUT(const T t) {
  std::cout << t;
}
template <typename First, typename... Rest>
void MACRO_OUT(const First first, const Rest... rest) {
  std::cout << first << " ";
  MACRO_OUT(rest...);
}
template <class S, class T, class U>
bool IN(S a, T x, U b) {
  return a <= x && x < b;
}
template <class T>
inline T CHMAX(T& a, const T b) {
  return a = (a < b) ? b : a;
}
template <class T>
inline T CHMIN(T& a, const T b) {
  return a = (a > b) ? b : a;
}
template <class T>
using V = std::vector<T>;
template <class T>
using VV = V<V<T>>;
template <typename S, typename T>
std::ostream& operator<<(std::ostream& os, std::pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
using i64 = std::int_fast64_t;
using u64 = std::uint_fast64_t;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using PAIR = std::pair<i64, i64>;
using PAIRLL = std::pair<ll, ll>;
constexpr int INFINT = (1 << 30) - 1;
constexpr int INFINT_LIM = (1LL << 31) - 1;
constexpr ll INFLL = 1LL << 60;
constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);
constexpr double eps = 1e-6;
constexpr i64 MOD = 998244353;
constexpr double PI = 3.141592653589793238462643383279;
template <class T, size_t N>
void FILL(T (&a)[N], const T& val) {
  for (auto& x : a) x = val;
}
template <class ARY, size_t N, size_t M, class T>
void FILL(ARY (&a)[N][M], const T& val) {
  for (auto& b : a) FILL(b, val);
}
template <class T>
void FILL(std::vector<T>& a, const T& val) {
  for (auto& x : a) x = val;
}
template <class ARY, class T>
void FILL(std::vector<std::vector<ARY>>& a, const T& val) {
  for (auto& b : a) FILL(b, val);
}
unsigned long long popCount(unsigned long long x) {
  x = ((x & 0xaaaaaaaaaaaaaaaaUL) >> 1) + (x & 0x5555555555555555UL);
  x = ((x & 0xccccccccccccccccUL) >> 2) + (x & 0x3333333333333333UL);
  x = ((x & 0xf0f0f0f0f0f0f0f0UL) >> 4) + (x & 0x0f0f0f0f0f0f0f0fUL);
  x = ((x & 0xff00ff00ff00ff00UL) >> 8) + (x & 0x00ff00ff00ff00ffUL);
  x = ((x & 0xffff0000ffff0000UL) >> 16) + (x & 0x0000ffff0000ffffUL);
  x = ((x & 0xffffffff00000000UL) >> 32) + (x & 0x00000000ffffffffUL);
  return x;
}
struct BIT {
  int N;
  using TYPE = int;
  std::vector<TYPE> bit;
  BIT() : N(0) {}
  BIT(int n) : N(n), bit(N + 1, 0) {}
  BIT(int n, TYPE init) : N(n), bit(N + 1, init) {}
  void add(int i, TYPE w) {
    for (int x = ++i; x <= N; x += x & -x) bit[x] += w;
  }
  TYPE sum(int i) {
    TYPE res = 0;
    for (int x = i; x > 0; x -= x & -x) res += bit[x];
    return res;
  }
  TYPE sum(int i, int j) { return sum(j) - sum(i); }
  const TYPE& operator[](const int& i) const { return bit[i]; }
};
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  VV<int> pop(16);
  for (int k = (1); k < (16); ++k) {
    pop[k].resize(1 << k);
    for (int i = (0); i < (1 << k); ++i) {
      pop[k][i] = popCount(i);
    }
  }
  VV<int> ord(16);
  for (int k = (1); k < (16); ++k) {
    ord[k].resize(1 << k);
    std::iota((ord[k]).begin(), (ord[k]).end(), 0);
    std::sort((ord[k]).begin(), (ord[k]).end(), [&](int l, int r) {
      return std::tie(pop[k][l], l) > std::tie(pop[k][r], r);
    });
  }
  int Q;
  MACRO_VAR_Scan(Q);
  ;
  for (int _ = (0); _ < (Q); ++_) {
    int n;
    MACRO_VAR_Scan(n);
    ;
    std::vector<int> A(n);
    for (auto& i : A) std::cin >> i;
    ;
    {
      bool ok = true;
      for (int i = (1); i < (n); ++i) {
        if (A[i - 1] >= A[i]) ok = false;
      }
      if (ok) {
        MACRO_OUT(0);
        std::cout << "\n";
        ;
        continue;
      }
    }
    {
      if (n == 2) {
        MACRO_OUT(1);
        std::cout << "\n";
        ;
        MACRO_OUT("1 2");
        std::cout << "\n";
        ;
        continue;
      }
    }
    [&] {
      for (auto bit : ord[n]) {
        V<int> a, b;
        for (int i = (0); i < (n); ++i) {
          if (bit & 1 << i)
            a.emplace_back(A[i]);
          else
            b.emplace_back(A[i]);
        }
        std::sort((b).begin(), (b).end());
        do {
          bool ok = [&] {
            int j = 0;
            auto a2(a);
            for (int i = (1); i < (a2.size()); ++i) {
              while (j < b.size() && a2[i - 1] >= a2[i]) {
                a2[i] += b[j];
                ++j;
              }
              if (a2[i - 1] >= a2[i]) return false;
            }
            return true;
          }();
          if (ok) {
            V<int> idxB;
            V<bool> used(n, false);
            for (int j = (0); j < (b.size()); ++j)
              for (int i = (0); i < (n); ++i) {
                if (used[i]) continue;
                if (!(bit & 1 << i) && b[j] == A[i]) {
                  idxB.emplace_back(i);
                  used[i] = true;
                  break;
                }
              }
            V<int> idxA;
            for (int i = (0); i < (n); ++i) {
              if (bit & 1 << i) idxA.emplace_back(i);
            }
            V<PAIR> ans;
            int j = 0;
            auto a2(a);
            for (int i = (1); i < (a2.size()); ++i) {
              while (j < b.size() && a2[i - 1] >= a2[i]) {
                a2[i] += b[j];
                ans.emplace_back(idxB[j], idxA[i]);
                ++j;
              }
            }
            while (j < b.size()) {
              ans.emplace_back(idxB[j], idxA.back());
              ++j;
            }
            BIT bit(n);
            for (int i = (0); i < (n); ++i) bit.add(i, 1);
            MACRO_OUT(ans.size());
            std::cout << "\n";
            ;
            for (int i = (0); i < (ans.size()); ++i) {
              MACRO_OUT(bit.sum(ans[i].first) + 1);
              std::cout << " ";
              MACRO_OUT(bit.sum(ans[i].second) + 1);
              std::cout << "\n";
              ;
              bit.add(ans[i].first, -1);
            }
            return;
          }
        } while (std::next_permutation((b).begin(), (b).end()));
      }
    }();
  }
  return 0;
}