#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int n, chn[300005], a[300005];
set<pair<int, int> > s;
vector<pair<int, int> > v;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    s.insert({x, i});
  }
  int i = 1;
  while (s.size()) {
    if (chn[i]) {
      i++;
      continue;
    }
    pair<int, int> p = *--s.end();
    s.erase(--s.end());
    int x = p.second, wr = p.first;
    chn[i] = x * 2 - 1;
    if (chn[i + wr])
      a[x * 2] = i + wr - 1;
    else if (i - wr >= 1 && chn[i - wr])
      a[x * 2] = i - wr + 1;
    else
      chn[i + wr] = x * 2;
  }
  for (int i = 1; i <= 2 * n; i++) {
    if (a[i]) v.push_back({i, chn[a[i]]});
  }
  for (int i = 1; i <= 2 * n; i++) {
    if (chn[i] && chn[i + 1]) v.push_back({chn[i], chn[i + 1]});
  }
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << ' ' << v[i].second << endl;
}
