#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const double dinf = 1e250;
const long long INF = (long long)(2e18);
const int inf = (int)(1e9 + 7);
struct myt {
  int d, s, t;
};
void out(int a, int b) { cout << a << " " << b << '\n'; }
vector<int> ind;
vector<vector<int> > g;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cin.tie(0);
  int n;
  cin >> n;
  vector<myt> ar(n);
  for (int i = 0; i < n; ++i) {
    cin >> ar[i].d;
    ar[i].s = 2 * i + 1;
    ar[i].t = 2 * i + 2;
  }
  sort(begin(ar), end(ar), [](myt a, myt b) { return a.d > b.d; });
  g.resize(2 * n);
  ind.resize(2 * n, 0);
  for (int i = 0; i < n; ++i) {
    int d = ar[i].d;
    if (ind[i] == 0)
      ind[i] = ar[i].s;
    else {
      --d;
      g[i].push_back(ar[i].s);
    }
    if (d == 0) {
      out(ar[i].s, ar[i].t);
    } else if (ind[i + d] == 0) {
      ind[i + d] = ar[i].t;
    } else {
      g[i + d - 1].push_back(ar[i].t);
    }
  }
  for (int i = 0; i < g.size(); ++i) {
    if (ind[i] == 0) continue;
    for (auto& it : g[i]) out(ind[i], it);
  }
  for (int i = 0; i < ind.size() - 1; ++i) {
    if (ind[i] == 0) continue;
    if (ind[i + 1] == 0) continue;
    out(ind[i], ind[i + 1]);
  }
  return 0;
}
