import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in = new Scanner(System.in);
		TreeMap<Double, String> map = new TreeMap<>();
		int n = in.nextInt();
		for(int i = 1; i <= n; i++) {
			double item = in.nextDouble();
			if(map.get(item) == null) map.put(item, Integer.toString(i));
			else {
				String str = map.get(item);
				str += Integer.toString(i);
				map.put(item, str);
			}
		}
		while(map.size() != 1) {
			double x = map.firstKey();
			String strX = map.get(x);
			char numx = '0';
			if(strX.length() == 1) {
				map.remove(x);
				numx = strX.charAt(0);
			}
			else {
				numx = strX.charAt(0);
				map.put(x, strX.substring(1));
			}
			double y = map.firstKey();
			String strY = map.get(y);
			char numy = '0';
			if(strY.length() == 1) {
				map.remove(y);
				numy = strY.charAt(0);
			}
			else {
				numy = strY.charAt(0);
				map.put(y, strY.substring(1));
			}
			int numXInt = Character.getNumericValue(numx);
			int numYInt = Character.getNumericValue(numy);
			System.out.println(Math.min(numXInt, numYInt) + " " + Math.max(numXInt, numYInt));
			double newKey = (x + y) / 2;
			if(map.get(newKey) == null) map.put(newKey, Integer.toString(++n));
			else {
				String str = map.get(newKey);
				str += Integer.toString(++n);
				map.put(newKey, str);
			}
		}
	}
}