#include <bits/stdc++.h>
const int M = 300000;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v.push_back(make_pair(x, i));
  }
  sort(v.begin(), v.end());
  for (int i = 0, j = n - 1; i < n / 2, j >= n / 2; i++, j--) {
    cout << v[i].second << " " << v[j].second << endl;
  }
}
