#include <bits/stdc++.h>
using namespace std;
struct Node {
  int num;
  vector<Node*> child;
};
void solve() {
  int n;
  cin >> n;
  auto d = vector<int>(n);
  for (auto i = 0; i < n; ++i) cin >> d[i];
  auto node_line = vector<Node*>(n);
  for (auto i = 0; i < n; ++i) {
    node_line[i] = new Node();
    node_line[i]->num = i * 2;
  }
  sort(node_line.begin(), node_line.end(),
       [&](Node* x, Node* y) { return d[x->num / 2] > d[y->num / 2]; });
  for (auto i = 0; i < n - 1; ++i)
    node_line[i]->child.push_back(node_line[i + 1]);
  for (auto i = 0; i < n; ++i) {
    auto num = node_line[i]->num;
    Node* node = new Node();
    node->num = num + 1;
    node_line[i + d[num / 2] - 1]->child.push_back(node);
    if (i + d[num / 2] - 1 == node_line.size() - 1) node_line.push_back(node);
  }
  auto st = stack<Node*>{};
  st.push(node_line[0]);
  while (!st.empty()) {
    auto node = st.top();
    st.pop();
    for (auto child_node : node->child) {
      cout << node->num + 1 << " " << child_node->num + 1 << endl;
      st.push(child_node);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
