#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5;
int par[MAXN], dep[MAXN];
vector<int> d[MAXN];
const int K = 20;
vector<int> g[1 << K];
int F[K][1 << K], D[1 << K];
void lca_dfs(int x) {
  for (int i = 0, ThxDem = g[x].size(); i < ThxDem; ++i) {
    int y = g[x][i];
    if (y == F[0][x]) continue;
    F[0][y] = x;
    D[y] = D[x] + 1;
    lca_dfs(y);
  }
}
void lca_init(int n) {
  D[0] = 0;
  F[0][0] = -1;
  lca_dfs(0);
  for (int k = 1, ThxDem = K; k < ThxDem; ++k)
    for (int x = 0, ThxDem = n; x < ThxDem; ++x)
      if (F[k - 1][x] < 0)
        F[k][x] = -1;
      else
        F[k][x] = F[k - 1][F[k - 1][x]];
}
int lca(int x, int y) {
  if (D[x] < D[y]) swap(x, y);
  for (int k = K - 1; k >= 0; --k)
    if (D[x] - (1 << k) >= D[y]) x = F[k][x];
  if (x == y) return x;
  for (int k = K - 1; k >= 0; --k)
    if (F[k][x] != F[k][y]) x = F[k][x], y = F[k][y];
  return F[0][x];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<int, pair<int, int>>> v(n);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i)
    cin >> v[i].first, v[i].second = {2 * i, 2 * i + 1};
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  memset(dep, -1, sizeof(dep));
  memset(par, -1, sizeof(par));
  vector<int> chn;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    d[i].push_back(v[i].second.first);
    dep[v[i].second.first] = i;
    if (i) par[v[i].second.first] = v[i - 1].second.first;
    chn.push_back(v[i].second.first);
  }
  int mx = n;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    int myd = i + 1, myo = mx;
    if (myo >= i + v[i].first) {
      par[v[i].second.second] = chn[i + v[i].first - 1];
      if (i + v[i].first == mx) chn.push_back(v[i].second.second), mx++;
    } else if (myd >= v[i].first) {
      par[v[i].second.second] = v[myd - v[i].first].second.first;
    } else {
      par[v[i].second.second] = d[v[i].first - myd].back();
    }
    dep[v[i].second.second] = dep[par[v[i].second.second]] + 1;
    d[dep[par[v[i].second.second]] + 1].push_back(v[i].second.second);
  }
  for (int i = 0, ThxDem = 2 * n; i < ThxDem; ++i)
    if (par[i] >= 0) cout << par[i] + 1 << " " << i + 1 << endl;
  for (int i = 0, ThxDem = 2 * n; i < ThxDem; ++i)
    if (par[i] >= 0) g[par[i]].push_back(i), g[i].push_back(par[i]);
  lca_init(2 * n);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    int l = lca(v[i].second.first, v[i].second.second);
    int de = D[v[i].second.first] + D[v[i].second.second] - 2 * D[l];
    assert(de == v[i].first);
  }
}
