#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 100;
int n, c;
int t[maxn];
struct p {
  int val;
  int pos;
} r[maxn];
bool cmp(p a, p b) { return a.val < b.val; }
int main() {
  cin >> n;
  map<int, int> pos;
  for (int i = 1; i <= n; i++) cin >> r[i].val, r[i].pos = i;
  sort(r + 1, r + n + 1, cmp);
  for (int i = 1; i <= n / 2; i++) {
    cout << r[i].pos << " " << r[n + 1 - i].pos << endl;
  }
}
