#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int mod = 1000000007;
const double PI = acos(-1.0);
struct node {
  int x, y;
};
int a[1005];
int b[1005];
int c[1005];
char s[1005];
bool vis[1005];
int n, m;
int ans;
int main() {
  int tt, ca = 1;
  int p, q;
  scanf("%d", &n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  sum = sum * 2 / n;
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    if (vis[i]) continue;
    vis[i] = true;
    for (int j = i + 1; j < n; j++) {
      if (vis[j]) continue;
      if (a[i] + a[j] != sum) continue;
      printf("%d %d\n", i + 1, j + 1);
      vis[j] = true;
      break;
    }
  }
  return 0;
}
