#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 10;
const int minf = -1e9;
const int maxLog = 20;
void solve() {
  vector<int> d;
  vector<pair<int, int> > results;
  int n;
  cin >> n;
  d.resize(n + 1);
  pair<int, int> maks = {0, 0};
  vector<pair<int, int> > V;
  vector<int> used(n + 1), pos(n + 1), halfUsed(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
    V.push_back({d[i], i});
  }
  sort(V.begin(), V.end());
  reverse(V.begin(), V.end());
  vector<int> list(2 * n + 10);
  int i2 = V[0].first;
  for (int i1 = 0; i1 < (int)V.size(); i1++) {
    if (list[i1] != 0) break;
    if (i2 - i1 == V[i1].first) {
      list[i1] = V[i1].second * 2;
      list[i2] = V[i1].second * 2 - 1;
      used[V[i1].second] = true;
      i2++;
    } else {
      list[i1] = V[i1].second * 2;
      pos[V[i1].second] = i1;
      halfUsed[V[i1].second] = true;
    }
  }
  for (int i = 1; i < i2; i++) {
    results.push_back({list[i], list[i - 1]});
  }
  for (auto p : V) {
    if (!used[p.second]) {
      if (halfUsed[p.second]) {
        results.push_back(
            {list[pos[p.second] + p.first - 1], 2 * p.second - 1});
      } else {
        results.push_back({list[0], 2 * p.second});
        if (p.first == 1) {
          results.push_back({2 * p.second, 2 * p.second - 1});
        } else {
          results.push_back({list[p.first - 2], 2 * p.second - 1});
        }
      }
    }
  }
  for (auto p : results) {
    cout << p.first << " " << p.second << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  solve();
}
