#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
int main() {
  lint n;
  cin >> n;
  vector<lint> v(n);
  for (lint i = 0; i < n; i++) {
    cin >> v[i];
  }
  lint val = 2 * accumulate(v.begin(), v.end(), 0ll) / n;
  vector<lint> visited(n);
  for (lint i = 0; i < n; i++) {
    if (visited[i]) {
      continue;
    }
    for (lint j = i + 1; j < n; j++) {
      if (visited[j]) {
        continue;
      }
      if (v[i] + v[j] == val) {
        visited[i] = 1;
        visited[j] = 1;
        cout << (i + 1) << " " << (j + 1) << endl;
        break;
      }
    }
  }
}
