#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  int n;
  cin >> n;
  vector<pair<int, int>> d(n);
  for (int i = 0; i < n; i++) {
    cin >> d[i].first;
    d[i].second = i * 2 + 1;
  }
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  vector<pair<int, int>> edges;
  set<pair<int, int>> event;
  int cnt = 1;
  int lst = -1;
  int nxt;
  for (int i = 0; i < n; i++) {
    event.insert({cnt + d[i].first - 1, d[i].second + 1});
    if (lst != -1) edges.push_back({lst, d[i].second});
    while (event.size() && event.begin()->first == cnt) {
      edges.push_back({d[i].second, event.begin()->second});
      nxt = event.begin()->second;
      event.erase(event.begin());
    }
    lst = d[i].second;
    cnt++;
  }
  for (int i = 0; i < n; i++) {
    int nxx = nxt;
    while (event.size() && event.begin()->first == cnt) {
      edges.push_back({nxt, event.begin()->second});
      nxx = event.begin()->second;
      event.erase(event.begin());
    }
    if (nxt == nxx) break;
    nxt = nxx;
    cnt++;
  }
  for (pair<int, int> a : edges) cout << a.first << ' ' << a.second << endl;
}
