#include <bits/stdc++.h>
using namespace std;
constexpr const int maxn = 1 << 17;
int d[maxn], p[maxn], chain[maxn << 2], pos[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> d[i];
  iota(p + 1, p + n + 1, 1);
  sort(p + 1, p + n + 1, [](int x, int y) -> bool { return d[x] > d[y]; });
  vector<pair<int, int>> res;
  for (int i = 1; i <= n; ++i) pos[i] = i & 1 ? i + 1 >> 1 : n + 1 - (i >> 1);
  for (int i = 1; i <= n; ++i) chain[n + pos[i]] = p[i] << 1;
  for (int i = 1; i != n; ++i) res.emplace_back(chain[n + i], chain[n + i + 1]);
  for (int i = 1, l = n + 1, r = n + n; i <= n; ++i) {
    int j = pos[i], k = chain[n + j] >> 1,
        cur = i & 1 ? n + j + d[k] - 1 : n + j - d[k] + 1;
    res.emplace_back(chain[n + j] - 1, chain[cur]);
    if (cur == l) chain[--l] = chain[n + j] - 1;
    if (cur == r) chain[++r] = chain[n + j] - 1;
  }
  for (const auto& ans : res) cout << ans.first << ' ' << ans.second << endl;
}
