#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  int minVal = *min_element(v.begin(), v.end());
  int maxVal = *max_element(v.begin(), v.end());
  int sum = minVal + maxVal;
  int visited[n];
  memset(visited, 0, sizeof visited);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (v[i] + v[j] == sum && !visited[i] && !visited[j]) {
        cout << i + 1 << " " << j + 1 << "\n";
        visited[i] = 1, visited[j] = 1;
        break;
      }
    }
  }
  return 0;
}
