#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1;
int n;
pair<int, int> t[maxn];
vector<int> line;
bool csokk(pair<int, int> a, pair<int, int> b) {
  return (a.first > b.first || (a.first == b.first && a.second < b.second));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  int d;
  for (int i = 0; i < n; i++) {
    cin >> d;
    t[i].first = d;
    t[i].second = 2 * i + 1;
  }
  sort(t, t + n, csokk);
  line.reserve(n);
  line.push_back(t[0].second);
  for (int i = 1; i < n; i++) {
    line.push_back(t[i].second);
    cout << t[i - 1].second << ' ' << t[i].second << '\n';
  }
  for (int i = 0; i < n; i++) {
    if (line[i + t[i].first - 1] == line.back()) {
      cout << line.back() << ' ';
      line.push_back(t[i].second + 1);
      cout << line.back() << '\n';
    } else {
      cout << line[i + t[i].first - 1] << ' ' << (t[i].second + 1) << '\n';
    }
  }
  return 0;
}
