import java.util.*;
import java.io.*;
import java.text.*;

class IPoint {
    int x;
    int y;

    public IPoint(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
 
        if (!(o instanceof IPoint)) {
            return false;
        }
        IPoint p = (IPoint)o;
        return p.x == this.x && p.y == this.y;
    }

    @Override
    public int hashCode() {
        return this.x * 2000 + this.y;
    }
}

public class NickyEnMark{

    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if (n == 1) {
            System.out.println("1 1");
            return;
        }

        Set<IPoint> pairs = new HashSet<>();

        for (int i = 0; i < n; i++) {
            int j = scanner.nextInt();

            IPoint p = new IPoint(i + 1, j);
            pairs.add(p);
        }

        IPoint cur = new IPoint(0, 0);
        for (int i = 0; i < n; i++) {
            IPoint closest = new IPoint(0, 0);
            int distance = 3 * n;
            for (IPoint p : pairs) {
                int nd = Math.abs(p.x - cur.x) + Math.abs(p.y - cur.y);
                if (nd < distance) {
                    distance = nd;
                    closest = p;
                }
            }

            pairs.remove(closest);
            System.out.println(closest.x + " " + closest.y);
            cur = closest;
        }
    }
}