#include <bits/stdc++.h>
using namespace std;
int const Nmax = 1e5 + 10;
pair<int, int> d[Nmax];
int Tree[Nmax];
int main() {
  {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  int n;
  cin >> n;
  for (int i = (int)1; i <= (int)n; ++i) cin >> d[i].first, d[i].second = i;
  sort(d + 1, d + n + 1, greater<pair<int, int> >());
  Tree[1] = d[1].second * 2 - 1;
  for (int i = (int)1; i <= (int)n - 1; ++i)
    cout << Tree[i] << ' ' << d[i + 1].second * 2 - 1 << '\n',
        Tree[i + 1] = d[i + 1].second * 2 - 1;
  int sz = n;
  for (int i = (int)1; i <= (int)n; ++i) {
    if (i + d[i].first - 1 <= sz) {
      cout << Tree[d[i].first + i - 1] << ' ' << d[i].second * 2 << '\n';
      if (i + d[i].first - 1 == sz) Tree[++sz] = d[i].second * 2;
    } else if (i - d[i].first + 1 > 0)
      cout << Tree[i - d[i].first + 1] << ' ' << d[i].second * 2 << '\n';
  }
}
