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