#include <bits/stdc++.h>
using namespace std;
vector<int> g[100005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  while (tc--) {
    int n;
    cin >> n;
    int d[n + 1];
    vector<pair<int, int> > v, ans;
    for (int i = 1; i <= n; i++) {
      cin >> d[i];
      v.push_back({d[i], i});
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    for (int i = 1; i < v.size(); i++)
      ans.push_back({v[i - 1].second * 2 - 1, v[i].second * 2 - 1});
    int indx[n];
    for (int i = 0; i < v.size(); i++) {
      if (i + v[i].first - 1 < v.size()) {
        int in = i + v[i].first - 1;
        ans.push_back({v[in].second * 2 - 1, v[i].second * 2});
        indx[i] = in;
        if (g[in].size() == 0) g[in].push_back(v[i].second * 2);
      } else {
        int age = indx[i - 1];
        int now = age - i;
        ans.push_back({g[age][v[i].first - now - 2], v[i].second * 2});
        if (v[i].first - now - 1 == g[age].size())
          g[age].push_back(v[i].second * 2);
        indx[i] = age;
      }
    }
    for (int i = 0; i < ans.size(); i++)
      cout << ans[i].first << ' ' << ans[i].second << endl;
  }
}
