#include <bits/stdc++.h>
using namespace std;
struct Matrix {
  long long mat[2][2];
};
Matrix MatMul(Matrix a, Matrix b) {
  Matrix ans;
  int k;
  for (int i = (0); i < (2); i++)
    for (int j = (0); j < (2); j++)
      for (ans.mat[i][j] = k = 0; k < 2; k++)
        ans.mat[i][j] =
            (ans.mat[i][j] + (a.mat[i][k] * b.mat[k][j]) % 1000000007) %
            1000000007;
  return ans;
}
Matrix MatPow(Matrix base, long long p) {
  Matrix ans;
  for (int i = (0); i < (2); i++)
    for (int j = (0); j < (2); j++) ans.mat[i][j] = (i == j);
  while (p) {
    if (p & 1) ans = MatMul(ans, base);
    base = MatMul(base, base);
    p >>= 1;
  }
  return ans;
}
long long pot(long long base, long long p) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % 1000000007;
    base = (base * base) % 1000000007;
    p >>= 1;
  }
  return ans;
}
int main() {
  int N;
  cin >> N;
  vector<pair<int, int> > V(N);
  for (int i = (0); i < (N); i++) {
    cin >> V[i].first;
    V[i].second = i + 1;
  }
  sort((V).begin(), (V).end());
  for (int i = (0); i < (N / 2); i++) {
    cout << V[i].second << " " << V[N - 1 - i].second << endl;
  }
}
