#include <bits/stdc++.h>
using namespace std;
pair<int, int> d[200100];
int idx[200100];
int pos[200100];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    d[i] = {x, i};
  }
  sort(d, d + n, greater<pair<int, int>>());
  vector<pair<int, int>> edge;
  for (int i = 0; i < n; i++) {
    idx[d[i].second * 2 + 1] = i;
    pos[i] = d[i].second * 2 + 1;
  }
  for (int i = 0; i < n - 1; i++) {
    int u = d[i].second * 2 + 1;
    int v = d[i + 1].second * 2 + 1;
    edge.push_back({u, v});
  }
  int lastidx = n - 1;
  for (int i = 0; i < n; i++) {
    int x = d[i].second * 2 + 2;
    int place = idx[x - 1] + d[i].first - 1;
    if (place == lastidx) {
      lastidx++;
      pos[lastidx] = x;
      idx[x] = lastidx;
    }
    edge.push_back({pos[place], x});
  }
  for (auto it : edge) cout << it.first << " " << it.second << "\n";
  return 0;
}
