#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> in;
vector<int> ans;
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  in.resize(N);
  ans.resize(N);
  for (int i = 0; i < N; i++) ans[i] = -1;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> in[i];
    sum += in[i];
  }
  int avg = sum * 2 / N;
  for (int i = 0; i < N / 2; i++) {
    int j;
    for (j = 0; j < N; j++)
      if (ans[j] == -1) break;
    ans[j] = i;
    cout << j + 1 << " ";
    int rem = avg - in[j];
    for (j = 0; j < N; j++)
      if (ans[j] == -1 && in[j] == rem) break;
    ans[j] = i;
    cout << j + 1 << "\n";
  }
  return 0;
}
