#include <bits/stdc++.h>
using namespace std;
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return POW(B, P / 2) * POW(B, P / 2);
}
template <typename T>
T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
int pallindrom(string s) {
  string second;
  second = s;
  reverse(s.begin(), s.end());
  if (second == s) {
    return 1;
  } else
    return -1;
}
int toInt(string s) {
  int sm;
  stringstream second(s);
  second >> sm;
  return sm;
}
long long toLlint(string s) {
  long long sm;
  stringstream second(s);
  second >> sm;
  return sm;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
template <class T>
string NTS(T Number) {
  stringstream second;
  second << Number;
  return second.str();
}
bool isprime(int w) {
  if (w == 0) return false;
  if (w == 1) return false;
  int sqrtw = int(sqrt((double)w));
  for (int q = 2; q <= sqrtw; q++) {
    if (w % q == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int x;
  scanf("%d", &x);
  vector<pair<int, int> > ve;
  int k = 1;
  while (x--) {
    int y;
    scanf("%d", &y);
    ve.push_back(make_pair(y, k++));
  }
  sort(ve.begin(), ve.end());
  for (int i = 0; i < ve.size() / 2; i++) {
    cout << ve[i].second << " " << ve[ve.size() - i - 1].second << "\n";
  }
}
