#include <bits/stdc++.h>
void qs(int l, int r, int *VL, int *ID) {
  int i = l;
  int j = r;
  int k = *(VL + (i + j) / 2);
  int temp = 0;
  while (i <= j) {
    while (*(VL + i) < k) i = i + 1;
    while (*(VL + j) > k) j = j - 1;
    if (i <= j) {
      temp = *(VL + i);
      *(VL + i) = *(VL + j);
      *(VL + j) = temp;
      temp = *(ID + i);
      *(ID + i) = *(ID + j);
      *(ID + j) = temp;
      i = i + 1;
      j = j - 1;
    }
  }
  if (l < j) qs(l, j, VL, ID);
  if (i < r) qs(i, r, VL, ID);
}
int main(void) {
  int *n = (int *)malloc(sizeof(int));
  scanf("%i", n);
  int *VL = (int *)malloc(*n * sizeof(int));
  int *ID = (int *)malloc(*n * sizeof(int));
  for (int i = 0; i < *n; i++) {
    scanf("%i", (VL + i));
    *(ID + i) = i + 1;
  }
  qs(0, *n - 1, VL, ID);
  for (int i = 0; i < *n / 2; i++)
    printf("%i %i\n", *(ID + i), *(ID + *n - 1 - i));
  free(VL);
  free(ID);
  free(n);
  return 0;
}
