#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0, forEach;
  cin >> n;
  pair<int, bool> card[n];
  for (int i = 0; i < n; i++) {
    cin >> card[i].first;
    sum += card[i].first;
    card[i].second = true;
  }
  forEach = sum / (n / 2);
  for (int i = 0; i < n; i++) {
    if (card[i].second) {
      card[i].second = false;
      for (int j = 0; j < n; j++) {
        if (card[j].second && card[j].first == forEach - card[i].first) {
          cout << i + 1 << ' ' << j + 1 << endl;
          card[j].second = false;
          break;
        }
      }
    }
  }
}
