#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int prime[1000009];
vector<int> prm;
void sv() {
  for (long i = 2; i * i <= 1e6; ++i) {
    if (!prime[i]) {
      for (long j = i * i; j <= 1e6; j = j + i) {
        prime[j] = i;
      }
    }
  }
  for (int i = 2; i <= 1000; i++) {
    if (prime[i] == 0) prm.push_back(i);
  }
}
int solve() {
  long long n;
  cin >> n;
  vector<int> a(2 * n);
  int mx = -1;
  int mp[1005] = {};
  vector<int> v(a.begin(), a.end());
  for (int i = 0; i < 2 * n; ++i) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  int gcd = -1;
  for (int &g : prm) {
    memset(mp, 0, sizeof(mp));
    for (int i = 0; i < a.size(); ++i) {
      v[i] = (a[i] % g);
      ++mp[v[i]];
    }
    int cnt = 2 * int(mp[0] / 2);
    for (int i = 1; i <= g / 2; ++i) {
      if (g % 2 == 0 && i == g / 2) {
        cnt += 2 * int(mp[i] / 2);
      } else
        cnt += 2 * min(mp[i], mp[g - i]);
    }
    if (cnt == (2 * n - 2) || cnt == 2 * n) {
      gcd = g;
      break;
    }
  }
  int done[100000] = {};
  int c = 0;
  for (int i = 0; i < 2 * n && c < 2 * n - 2; ++i) {
    int x = a[i];
    if (done[i] == 1) continue;
    for (int j = i + 1; c < 2 * n - 2 && j < 2 * n; ++j) {
      if (done[j] == 1) continue;
      int y = a[j];
      if ((x + y) % gcd == 0) {
        done[i] = done[j] = 1;
        cout << i + 1 << " " << j + 1 << endl;
        c += 2;
        break;
      }
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  sv();
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
