#include <bits/stdc++.h>
using namespace std;
int n, number, mx = -1, mn = 1000;
int arr[105];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> number;
    mx = max(mx, number);
    mn = min(mn, number);
    arr[i] = number;
  }
  int sum = mx + mn;
  for (int i = 0; i < n; i++) {
    int num = arr[i];
    int com = sum - num;
    if (arr[i] != -1)
      for (int y = 0; y < n; y++) {
        if (arr[y] != -1 && arr[y] == com && i != y) {
          if (arr[i] <= arr[y])
            cout << i + 1 << " " << y + 1 << endl;
          else
            cout << y + 1 << " " << i + 1 << endl;
          arr[i] = -1;
          arr[y] = -1;
          break;
        }
      }
  }
  return 0;
}
