#include <bits/stdc++.h>
using namespace std;
int n, m, ans, cnt, tot;
struct node {
  int d, id;
} a[500010];
int b[500010], dis[500010], dy[500010];
char s[500010];
bool in[500010];
vector<int> add[500010];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
inline bool cmp(const node &x, const node &y) { return x.d > y.d; }
inline void prework() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].d);
    a[i].id = i;
    dis[i] = a[i].d;
  }
  sort(a + 1, a + 1 + n, cmp);
}
inline void mainwork() {
  cnt = 1;
  pair<int, int> d;
  for (int i = 1; i <= n; i++) {
    b[cnt] = 2 * a[i].id - 1;
    dy[a[i].id] = cnt;
    q.push(make_pair(cnt + a[i].d, a[i].id));
    ++cnt;
    while (!q.empty()) {
      d = q.top();
      if (d.first == cnt) {
        q.pop();
        b[cnt] = 2 * d.second;
        ++cnt;
      } else if (d.first < cnt) {
        q.pop();
        add[d.first - 1].push_back(2 * d.second);
      } else
        break;
    }
  }
  cnt--;
  int id;
  while (!q.empty()) {
    d = q.top();
    q.pop();
    id = dy[d.second] - dis[d.second];
    add[id + 1].push_back(2 * d.second);
  }
}
inline void print() {
  for (int i = 1; i < cnt; i++) printf("%d %d\n", b[i], b[i + 1]);
  for (int i = 1; i <= cnt; i++) {
    int l = add[i].size();
    for (int j = 0; j < l; j++) printf("%d %d\n", b[i], add[i][j]);
  }
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    prework();
    mainwork();
    print();
  }
  return 0;
}
