import java.io.*;

import java.util.*;

public class Main{
    public static void main(String[] args) throws Exception {
        Scanner s = new Scanner(new File("trains.in"));
        PrintWriter p = new PrintWriter(new File("trains.out"));

        Stack<Integer> dlock = new Stack<Integer>();
        Stack<Integer> way = new Stack<Integer>();

        int n = s.nextInt();
        int[] temp = new int[n];
        for(int i = 0; i < n; i++){
            way.add(0,s.nextInt());
        }
        int i = 1;
        
        while(true){
            if (way.empty() && dlock.empty()) break;
            if(!dlock.empty() && dlock.peek() == i){
                p.println(2+" "+1);

                dlock.pop();
                i++;
            }
            else{
                if(way.empty() && !dlock.empty()){

                    p.close();
                    PrintWriter pr = new PrintWriter(new File("trains.out"));
                    pr.println(0);
                    pr.close();
                    break;
                }
                p.println(1+" "+1);
                dlock.push(way.pop());
            }



        }

          p.close();
    }

}