#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, sum = 0;
  cin >> n;
  long long a[n], v[n];
  for (i = 0; i < n; i++) {
    v[i] = 0;
    cin >> a[i];
    sum += a[i];
  }
  long long x = n / 2;
  sum = sum / x;
  for (i = 0; i < n; i++) {
    if (v[i] == 0) {
      v[i] = 1;
      for (j = i + 1; j < n; j++) {
        if (v[j] == 0) {
          if (a[i] + a[j] == sum) {
            cout << i + 1 << " " << j + 1 << endl;
            v[j] = 1;
            break;
          }
        }
      }
    }
  }
  return 0;
}
