#include <bits/stdc++.h>
using namespace std;
pair<int, int> d[100005];
int chain[200005];
vector<pair<int, int>> ans;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d[i].first;
    d[i].second = i + i + 1;
  }
  sort(d, d + n);
  chain[0] = d[n - 1].second;
  chain[d[n - 1].first] = d[n - 1].second + 1;
  int p = 1;
  int c = p;
  while (c < d[n - 1].first && n - 1 - p >= 0) {
    int dist = d[n - 1 - p].first;
    chain[c] = d[n - 1 - p].second;
    if (c + dist >= d[n - 1].first && !chain[c + dist])
      chain[c + dist] = d[n - 1 - p].second + 1;
    else
      ans.push_back({d[n - 1 - p].second + 1, -(c + dist - 1)});
    c++;
    p++;
  }
  while (n - 1 - p >= 0) {
    if (d[n - 1 - p].first == 1) {
      ans.push_back({d[n - 1 - p].second, chain[0]});
      ans.push_back({d[n - 1 - p].second, d[n - 1 - p].second + 1});
    } else {
      ans.push_back({d[n - 1 - p].second, chain[0]});
      ans.push_back({d[n - 1 - p].second + 1, chain[d[n - 1 - p].first - 2]});
    }
    p++;
  }
  int c2 = 0;
  while (chain[c2 + 1]) {
    ans.push_back({chain[c2], chain[c2 + 1]});
    c2++;
  }
  for (auto it : ans) {
    if (it.second < 0)
      cout << it.first << " " << chain[-it.second] << '\n';
    else
      cout << it.first << ' ' << it.second << '\n';
  }
  return 0;
}
