#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 100002;
int n;
struct bpair {
  int index, d, lvlA, lvlB, y;
};
bpair v[N_MAX];
bool s1(const bpair &a, const bpair &b) { return (a.d < b.d); }
bool s2(const bpair &a, const bpair &b) { return (a.y < b.y); }
vector<int> onLevelA[N_MAX];
vector<int> onLevelB[N_MAX];
int cntA, cntB;
vector<pair<int, int> > edges;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i].d;
    v[i].index = i;
  }
  sort(v + 1, v + n + 1, s1);
  for (int i = 1; i <= n; i++) {
    if (cntA == 1 && v[i].d == 1) {
      edges.push_back(make_pair(v[i].index * 2 - 1, v[i].index * 2));
      continue;
    }
    if (cntA <= 1 || cntA + 1 <= v[i].d) cntA++;
    onLevelA[cntA].push_back(v[i].index);
    v[i].lvlA = cntA;
  }
  for (int i = 1; i <= n; i++) v[i].y = v[i].d - v[i].lvlA + 1;
  sort(v + 1, v + n + 1, s2);
  for (int i = 1; i <= n; i++) {
    if (cntB == 0 || cntB + 1 <= v[i].y) cntB++;
    onLevelB[cntB].push_back(v[i].index);
    v[i].lvlB = cntB;
  }
  for (int i = 1; i <= n; i++)
    if (v[i].lvlA > 1)
      edges.push_back(make_pair(v[i].index * 2 - 1,
                                onLevelA[v[i].lvlA - 1].front() * 2 - 1));
  for (int i = 1; i <= n; i++)
    if (v[i].lvlB > 1)
      edges.push_back(
          make_pair(v[i].index * 2, onLevelB[v[i].lvlB - 1].front() * 2));
  for (int i : onLevelB[1])
    edges.push_back(make_pair(i * 2, onLevelA[1][0] * 2 - 1));
  for (auto p : edges) cout << p.first << " " << p.second << "\n";
  return 0;
}
