#include <bits/stdc++.h>
using namespace std;
void radixsort(long long a[], long long b[], long long n) {
  long long temp1, temp2, I, K;
  long long sor[n], k = 0, i, c[10], j, B[n];
  for (K = 0; K < 10; K++) {
    k++;
    for (j = 0; j < 10; j++) c[j] = 0;
    for (i = 0; i < n; i++) {
      temp1 = a[i];
      for (j = 0; j < k; j++) {
        temp2 = temp1 % 10;
        temp1 = temp1 / 10;
      }
      c[temp2]++;
    }
    for (I = 1; I < 10; I++) c[I] = c[I] + c[I - 1];
    for (i = n - 1; i >= 0; i--) {
      temp1 = a[i];
      for (j = 0; j < k; j++) {
        temp2 = temp1 % 10;
        temp1 = temp1 / 10;
      }
      sor[c[temp2] - 1] = a[i];
      B[c[temp2] - 1] = b[i];
      c[temp2]--;
    }
    for (i = 0; i < n; i++) {
      a[i] = sor[i];
      b[i] = B[i];
    }
  }
}
int main() {
  long long n, i;
  cin >> n;
  long long a[n], b[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = i;
  }
  radixsort(a, b, n);
  for (i = 0; i < n / 2; i++)
    cout << b[i] + 1 << " " << b[n - i - 1] + 1 << endl;
}
