#include <bits/stdc++.h>
using namespace std;
vector<int> e[200000];
vector<int> g;
int main() {
  int n;
  cin >> n;
  pair<int, int> a[n], b[n];
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    b[i] = a[i] = {x, 2 * i + 1};
  }
  sort(a, a + n);
  for (int i = n - 1; i >= 0; i--) g.push_back(a[i].second);
  for (int i = 0; i < n; i++) {
    if (b[g[i] / 2].first + i == g.size())
      g.push_back(g[i] + 1);
    else
      e[g[b[g[i] / 2].first + i - 1]].push_back(g[i] + 1);
  }
  for (int i = 1; i < g.size(); i++) e[g[i]].push_back(g[i - 1]);
  for (int i = 0; i <= 2 * n; i++) {
    for (auto j : e[i]) cout << i << " " << j << "\n";
  }
}
