#!/usr/bin/env python3
import random
n = int(input())
points = [(i+1,int(c)) for i,c in enumerate(input().split())]
random.shuffle(points)

x, y = 1,1
result = []
while len(points) > 0:
    i,j = points.pop()
    result.append("%i %i" % (i,j))
    x,y = i,j
print(*result, sep='\n')
