#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  while (cin >> n) {
    int a, arr[10000], d = 0, s = 0, b;
    for (i = 1; i <= n; i++) {
      scanf("%d", &a);
      arr[d++] = a;
      s += a;
    }
    b = s / (n / 2);
    for (int i = 0; i < s; i++) {
      for (int j = i + 1; j < s; j++) {
        if (arr[i] + arr[j] == b) {
          printf("%d %d\n", i + 1, j + 1);
          arr[i] = 0, arr[j] = 0;
        }
      }
    }
  }
  return 0;
}
