#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int> > g;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    g.push_back(make_pair(a, i + 1));
  }
  sort(g.begin(), g.end());
  int k = g.size() - 1;
  for (int i = 0; i < n / 2; i++) {
    cout << g[i].second << " " << g[k].second << "\n";
    k--;
  }
  return 0;
}
