#include <bits/stdc++.h>
const int MAX_N = 2e5 + 7;
int n, d[MAX_N], ord[MAX_N], lift[20][MAX_N], depth[MAX_N];
int main(void) {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  memset(lift, 0xff, sizeof(lift));
  std::cin >> n;
  for (int i = 0; i < n; ++i) std::cin >> d[ord[i] = i];
  std::sort(ord, ord + n, [&](int i, int j) { return d[i] > d[j]; });
  int lowest = 0;
  for (int i = 0; i + 1 < n; ++i) {
    std::cout << 2 * ord[i] + 1 << " " << 2 * ord[i + 1] + 1 << "\n";
    lift[0][2 * ord[i + 1]] = 2 * ord[i];
    depth[2 * ord[i + 1]] = depth[2 * ord[i]] + 1;
    lowest = 2 * ord[i + 1];
  }
  for (int lg = 1; lg < 20; ++lg) {
    for (int i = 0; i < 2 * n; ++i) {
      int mid = lift[lg - 1][i];
      if (mid != -1) lift[lg][i] = lift[lg - 1][mid];
    }
  }
  for (int i = 0; i < n; ++i) {
    int me = 2 * ord[i];
    int ot = 2 * ord[i] + 1;
    int req = d[ord[i]] - 1;
    int go_down = depth[me] + req;
    int go_up = depth[lowest] - go_down;
    int cur;
    if (go_up < 0) {
      go_up = req;
      cur = me;
    } else {
      cur = lowest;
    }
    for (int k = 0; k < 20; ++k) {
      if ((1 << k) & go_up) cur = lift[k][cur];
    }
    lift[0][ot] = cur;
    depth[ot] = depth[cur] + 1;
    if (depth[lowest] < depth[ot]) lowest = ot;
    for (int lg = 1; lg < 20; ++lg) {
      int mid = lift[lg - 1][ot];
      if (mid != -1) lift[lg][ot] = lift[lg - 1][mid];
    }
    std::cout << ot + 1 << " " << cur + 1 << "\n";
  }
  return 0;
}
