#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#define Maxn 100008 
using namespace std;
typedef long long ll;

int n,cnt;
int son[Maxn];
map <ll,int> M;
struct node{
	int num;
	ll val;
}N[Maxn];

struct edge{
	int u,v;
}E[Maxn];

bool cmp(node a,node b){	return a.val > b.val;}

int main()
{
	memset(son,0,sizeof(son));
	scanf("%d",&n);
	for(int i = 1;i <= n;i ++)
	{
		ll d;
		scanf("%lld",&d);
		M[d] = i;
		N[i].num = i,N[i].val = d;
	}
	sort(N+1,N+1+n,cmp);
	map<ll,int>::iterator iter;;
	for(int i = 1;i <= n;i ++)
	{
		iter = M.find(N[i].val - n + 2 + (son[N[i].num] << 1));
		if(iter == M.end()) continue;
//		cout << iter->second << endl;
		int v = iter->second;
//		E[cnt].u = i;
//		E[cnt++].v = v;
		son[v] += son[N[i].num]+1;
		printf("%d %d\n",N[i].num,v);
	}
	return 0;
}