#include <bits/stdc++.h>
using namespace std;
void IO() {
  srand(chrono::steady_clock::now().time_since_epoch().count());
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  IO();
  long long int n;
  cin >> n;
  vector<pair<int, int> > arr;
  int a;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    cin >> a;
    arr.push_back(make_pair(a, i + 1));
  }
  sort(arr.begin(), arr.end(), greater<pair<int, int> >());
  vector<pair<int, int> > ans;
  map<int, int> dist;
  map<int, int> node_dist;
  dist[1] = 2 * arr[0].second - 1;
  node_dist[2 * arr[0].second - 1] = 1;
  for (__typeof(n) i = (1) - ((1) > (n)); i != (n) - ((1) > (n));
       i += 1 - 2 * ((1) > (n))) {
    ans.push_back(make_pair(2 * arr[i - 1].second - 1, 2 * arr[i].second - 1));
    dist[i + 1] = 2 * arr[i].second - 1;
    node_dist[2 * arr[i].second - 1] = i + 1;
  }
  int max_dist = n;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    int node = 2 * arr[i].second - 1;
    int c_dist = node_dist[node];
    int want = c_dist + arr[i].first - 1;
    if (want >= max_dist) {
      int that = dist[max_dist];
      ans.push_back(make_pair(that, 2 * arr[i].second));
      max_dist = want + 1;
      dist[max_dist] = 2 * arr[i].second;
    } else {
      int that = dist[want];
      ans.push_back(make_pair(that, 2 * arr[i].second));
    }
  }
  for (auto it : ans) {
    cout << it.first << " " << it.second << "\n";
  }
  return 0;
}
