#include <bits/stdc++.h>
using namespace std;
int a[55][5], s[110];
int tonghang[55], dem0hang[55], d[110];
int n, ln, nn;
int coketqua;
int tong;
void tim(int i, int j) {
  int k, x, kt;
  if (coketqua == 1) {
    return;
  }
  if (j == 3) {
    if (tong != tonghang[i]) {
      return;
    }
    j = 1;
    i = i + 1;
  }
  if (i == n / 2 + 1) {
    coketqua = 1;
    for (i = 1; i <= n / 2; i++) {
      for (j = 1; j <= 2; j++) {
        if (j != 1) {
          printf(" ");
        }
        printf("%d", a[i][j]);
      }
      printf("\n");
    }
    return;
  }
  for (k = 1; k <= n; k++) {
    if (d[k] == 0) {
      kt = 0;
      if (tonghang[i] + s[k] > tong) kt = 1;
      dem0hang[i]--;
      if (dem0hang[i] == 1) {
        if ((tonghang[i] + s[k] + ln < tong) ||
            (tonghang[i] + s[k] + nn > tong)) {
          kt = 1;
        }
      }
      if (kt == 0) {
        a[i][j] = k;
        d[k] = 1;
        tonghang[i] = tonghang[i] + s[k];
        tim(i, j + 1);
        d[k] = 0;
        a[i][j] = -1;
        tonghang[i] = tonghang[i] - s[k];
      }
      dem0hang[i]++;
    }
  }
}
void xuly() {
  int i, j;
  int tongg;
  for (i = 1; i <= n / 2; i++) {
    tonghang[i] = 0;
    dem0hang[i] = 2;
    for (j = 1; j <= 2; j++) {
      a[i][j] = -1;
    }
  }
  tongg = 0;
  for (i = 1; i <= n; i++) {
    tongg = tongg + s[i];
  }
  tong = tongg / (n / 2);
  coketqua = 0;
  for (i = 1; i <= n; i++) {
    d[i] = 0;
  }
  tim(1, 1);
}
int main() {
  int i, j;
  while (scanf("%d", &n) > 0) {
    for (i = 1; i <= n; i++) {
      scanf("%d", &s[i]);
    }
    ln = 0;
    nn = 110;
    for (i = 1; i <= n; i++) {
      if (s[i] > ln) {
        ln = s[i];
      }
      if (s[i] < nn) {
        nn = s[i];
      }
    }
    xuly();
    printf("\n");
  }
  return 0;
}
