#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[100005];
  bool b[100005] = {0};
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  long long k = (sum * 2) / n;
  long long j = 1;
  long long l;
  for (long long i = 1; i <= n / 2; i++) {
    while (b[j]) j++;
    for (l = j + 1; l <= n; l++) {
      if (a[l] == k - a[j] && !b[l]) {
        b[l] = true;
        break;
      }
    }
    b[j] = true;
    cout << j << " " << l << endl;
  }
  return 0;
}
