#include <bits/stdc++.h>
using namespace std;
template <class T>
struct rge {
  T b, e;
};
template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
};
template <class A, class B>
ostream &operator<<(ostream &os, pair<A, B> p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, rge<T> d) {
  os << "[";
  for (auto it = d.b; it != d.e; it++) os << (it == d.b ? "" : ", ") << *it;
  return os << "]";
}
const int N = 1e5 + 5;
struct edge {
  int dist, u;
};
vector<edge> edges;
vector<int> bulb;
int n;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
  while (cin >> n) {
    edges.clear();
    for (int i = (1); i <= ((n)); i += (+1)) {
      int dist;
      cin >> dist;
      edges.push_back({dist, 2 * i});
    }
    sort((edges).begin(), (edges).end(),
         [&](edge a, edge b) { return a.dist > b.dist; });
    bulb.clear();
    for (edge &e : edges) {
      bulb.push_back(e.u);
    }
    for (int i = (0); i <= ((n - 1) - 1); i += (+1)) {
      cout << bulb[i] << " " << bulb[i + 1] << '\n';
    }
    for (int i = (0); i <= ((n)-1); i += (+1)) {
      int u = edges[i].u - 1;
      if (i + edges[i].dist >= (bulb).size()) {
        bulb.push_back(u);
        cout << bulb[(bulb).size() - 2] << " " << bulb[(bulb).size() - 1]
             << '\n';
      } else {
        cout << bulb[i + edges[i].dist - 1] << " " << u << '\n';
      }
    }
    cout << '\n';
  }
  return 0;
}
