#include <bits/stdc++.h>
using namespace std;
const bool debug = 0;
int MX = 2005;
vector<int> spf(MX, -1);
void sieve() {
  for (long long int i = 2; i * i <= MX; ++i) {
    if (spf[i] == -1) {
      for (long long int j = i * i; j <= MX; j += i)
        if (spf[j] == -1) spf[j] = i;
    }
  }
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(2 * n);
  for (int &x : a) cin >> x;
  vector<pair<int, int> > ans;
  vector<int> cnt[2];
  for (int i = 0; i < 2 * n; ++i) cnt[a[i] % 2].push_back(i);
  int val1 = ((cnt[0].size() - 1));
  int val2 = ((cnt[1].size() - 1));
  if (val1 + val2 >= n - 1) {
    for (int i = 1; i < cnt[0].size(); i += 2)
      ans.push_back({cnt[0][i - 1], cnt[0][i]});
    for (int i = 1; i < cnt[1].size(); i += 2)
      ans.push_back({cnt[1][i - 1], cnt[1][i]});
  } else
    for (int g = 3; g <= 2000; g += 2) {
      vector<int> cntg[g];
      int val = 0;
      for (int i = 0; i < 2 * n; ++i) cntg[a[i] % g].push_back(i);
      for (int i = 1; i < g - i; ++i) {
        val += min(cntg[i].size(), cntg[g - i].size());
      }
      val += (cntg[0].size() - 1);
      if (val >= n - 1) {
        for (int i = 1; i < cntg[0].size(); i += 2)
          ans.push_back({cntg[0][i - 1], cntg[0][i]});
        for (int i = 1; i < g - i; ++i) {
          int v = min(cntg[i].size(), cntg[g - i].size());
          for (int j = 0; j < v; ++j)
            ans.push_back({cntg[i][j], cntg[g - i][j]});
        }
      }
    }
  for (int i = 0; i < n - 1; ++i) {
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int _;
  cin >> _;
  sieve();
  while (_--) {
    solve();
  }
  return 0;
}
