#include <bits/stdc++.h>
using namespace std;
const int NIL = -1;
template <class T>
inline T mx(T a, T b) {
  return a > b ? a : b;
}
template <class T>
inline T mi(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline void sw(T &a, T &b) {
  T t = a;
  a = b;
  b = t;
}
template <class T>
inline T mabs(T x) {
  return x < 0 ? -x : x;
}
inline char gc() {
  char ret;
  while ((ret = getchar()) == ' ' || ret == '\n' || ret == '\t')
    ;
  return ret;
}
template <class T>
inline T sq(T x) {
  return x * x;
}
vector<pair<int, pair<int, int> > > dat;
vector<int> chain, d, val;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n, w;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> w;
    dat.push_back(make_pair(w, make_pair(i << 1, (i << 1) - 1)));
  }
  sort(dat.begin(), dat.end());
  for (int i = dat.size() - 1; i >= 0; i--) {
    chain.push_back(dat[i].second.first);
    d.push_back(dat[i].first);
    val.push_back(dat[i].second.second);
  }
  for (int i = 0; i < n; i++) {
    if (d[i] + i - 1 >= (int)chain.size() - 1) {
      chain.push_back(val[i]);
    } else {
      cout << val[i] << ' ' << chain[d[i] + i - 1] << '\n';
    }
  }
  for (int i = 1; i < chain.size(); i++) {
    cout << chain[i] << ' ' << chain[i - 1] << '\n';
  }
  return 0;
}
