#include <bits/stdc++.h>
using namespace std;
const int N = 223456;
int dist[N];
int path[N];
int main() {
  ios ::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<int, int>> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first;
    arr[i].second = 2 * (i + 1);
  }
  sort(arr.begin(), arr.end());
  reverse(arr.begin(), arr.end());
  vector<pair<int, int>> ans;
  for (int i = 1; i <= n; i++) {
    if (i <= n - 1) {
      ans.push_back(make_pair(arr[i - 1].second, arr[i].second));
    }
    dist[i - 1] = arr[i - 1].second;
    path[i - 1] = i;
  }
  for (int i = 1; i <= n; i++) {
    int len = arr[i - 1].first;
    int u = arr[i - 1].second;
    int augment = i + len - 1;
    int node = path[augment - 1];
    if (augment >= n && path[augment] < node) {
      dist[augment] = u - 1;
      path[augment] = node;
    }
    ans.push_back(make_pair(u - 1, dist[augment - 1]));
  }
  for (auto edge : ans) {
    cout << edge.first << ' ' << edge.second << endl;
  }
}
