#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, vector<pair<int, int> > > pairs;
  vector<int> vec, flag;
  int cards, cardValue, sum = 0, average;
  scanf("%d", &cards);
  for (int x = 0; x < cards; x++) {
    scanf("%d", &cardValue);
    vec.push_back(cardValue);
    flag.push_back(0);
    sum += cardValue;
  }
  average = sum / (cards / 2);
  for (int i = 0; i < vec.size(); i++) {
    for (int j = i + 1; j < vec.size(); j++) {
      if (vec[i] + vec[j] == average && !flag[i] && !flag[j]) {
        flag[i] = 1, flag[j] = 1;
        printf("%d %d\n", i + 1, j + 1);
      }
    }
  }
  return 0;
}
