#include <bits/stdc++.h>
using namespace std;
using namespace std;
class dat {
 public:
  int id, rank;
  dat() {}
  void read(int i) {
    id = i + 1;
    scanf("%d", &rank);
  }
  bool operator<(const dat& A) const { return rank > A.rank; }
  void print() { cout << id << " " << rank << endl; }
} a[200005];
int N, mat[200005], ptr;
int main() {
  scanf("%d", &N);
  for (int i = 0; i < (N); i++) a[i].read(i);
  sort(a, a + N);
  ptr = N;
  for (int i = 0; i < (N); i++) {
    mat[i] = a[i].id * 2;
    if (i) printf("%d %d\n", mat[i - 1], mat[i]);
  }
  for (int i = 0; i < (N); i++) {
    int nxt = i + a[i].rank;
    printf("%d %d\n", mat[nxt - 1], 2 * a[i].id - 1);
    if (ptr == nxt) mat[ptr++] = 2 * a[i].id - 1;
  }
  return 0;
}
