#include <bits/stdc++.h>
using namespace std;
const long long ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const double eps = 1e-7;
const int N = 1e6 + 6, MID = 5e5;
int n;
pair<int, int> d[N];
int a[N], pos[N];
vector<pair<int, int> > ans;
int getPos(int i) { return MID - (n + 1) / 2 + i; }
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> d[i].first;
    d[i].second = i;
  }
  sort(d + 1, d + n + 1);
  int l = 1, r = n + 1;
  for (int i = n; i >= 1; --i) {
    if (!a[getPos(l)]) {
      a[getPos(l)] = d[i].second * 2;
      pos[d[i].second] = l;
      --r;
    } else {
      a[getPos(r)] = d[i].second * 2;
      pos[d[i].second] = r;
      ++l;
    }
  }
  for (int i = 1; i <= n - 1; ++i) {
    ans.emplace_back(a[getPos(i)], a[getPos(i + 1)]);
  }
  for (int i = n; i >= 1; --i) {
    int step = 1;
    if ((n - i) & 1) {
      d[i].first = -d[i].first;
      step = -1;
    }
    if (!a[getPos(pos[d[i].second] + d[i].first)]) {
      a[getPos(pos[d[i].second] + d[i].first)] = 2 * d[i].second - 1;
    }
    ans.emplace_back(a[getPos(pos[d[i].second] + d[i].first - step)],
                     2 * d[i].second - 1);
  }
  assert((int)ans.size() == 2 * n - 1);
  for (auto it : ans) {
    cout << it.first << " " << it.second << "\n";
  }
  return 0;
}
