#include <bits/stdc++.h>
using namespace std;
int n, d[1000001], a[1000001];
bool cmp(int a, int b) { return d[(a + 1) >> 1] > d[(b + 1) >> 1]; }
vector<int> v[100001];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &d[i]);
  for (int i = 1; i <= n; ++i) a[i] = (i << 1) - 1;
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; ++i) v[i].push_back(a[i]);
  for (int i = 1; i < n; ++i) printf("%d %d\n", a[i], a[i + 1]);
  for (int i = 1; i <= n; ++i) {
    int pos = min(i + d[(a[i] + 1) >> 1] - 1, n);
    printf("%d %d\n", a[i] + 1, v[pos][d[(a[i] + 1) >> 1] - (pos - i) - 1]);
    if (v[pos].size() == d[(a[i] + 1) >> 1] - (pos - i))
      v[pos].push_back(a[i] + 1);
  }
  return 0;
}
