/**
 * Created by IntelliJ IDEA.
 * User: m09cke
 * Date: 18.11.2009
 * Time: 17:07:50
 * To change this template use File | Settings | File Templates.
 */
import java.lang.*;
import java.io.*;
import java.util.Arrays;

public class Main implements Runnable{

    class Dot implements Comparable<Dot>{
        int x;
        int y;
        Dot(int a, int b){
            x = a;
            y = b;
        }
        public int getX(){
            return(x);
        }
        public int getY(){
            return(y);
        }
        public int compareTo(Dot a){
            if(x!=a.x) {
                if (a.x==0) return (-1);
                if (x==0) return(1);
                return(x-a.x);
            }
            if(y<a.y) return(-1);
            if(y==a.y) return(0);
            return(1);
        }
    }

    class Dna implements Comparable<Dna>{
        String s;
        int num;
        public String getString(){
            return(s);
        }
        Dna(String st){
            s=st;
            num=0;
            for (int i=0; i<(s.length()-1); i++){
                for (int j=i+1; j<s.length(); j++){
                    if (s.charAt(i)=='T'&&s.charAt(j)=='A') num++;
                    if (s.charAt(i)=='T'&&s.charAt(j)=='C') num++;
                    if (s.charAt(i)=='T'&&s.charAt(j)=='G') num++;
                    if (s.charAt(i)=='G'&&s.charAt(j)=='A') num++;
                    if (s.charAt(i)=='G'&&s.charAt(j)=='C') num++;
                    if (s.charAt(i)=='C'&&s.charAt(j)=='A') num++;
                }
            }
        }
        public int compareTo(Dna a){
            return(num-a.num);
        }
    }

    public void run(){
        try{
            StreamTokenizer in = new StreamTokenizer( new BufferedReader( new FileReader( new File( "trains.in"))));
            PrintStream out = new PrintStream(new File("trains.out"));
            in.nextToken();
            int n = (int)in.nval;
            int[] a = new int[n+1];
            int[] b = new int[n+1];
            int[][] steps = new int[3*n][2];
            Arrays.fill(a,0);
            Arrays.fill(b,0);
            int l = 0;
            int u = 0;
            for (int i=0; i<n; i++){
                in.nextToken();
                a[i]=(int)in.nval;
            }
            boolean t = true;
            int k=0;
            int s=0;
            while (t && k<n){
                k++;
                if (b[u]==k){
                    while (b[u]==k){
                        u--;
                        steps[s][0]=2;
                        steps[s][1]=1;
                        s++;
                    }
                }
                else{
                    boolean p=false;
                    for (int i=l; i<n; i++){
                        if (a[i]==k){
                            p=true;
                            steps[s][0]=1;
                            steps[s][1]=i-l+1;
                            s++;
                            for (int j=l; j<=i; j++){
                                u++;
                                b[u]=a[j];
                            }
                            l=i+1;
                        }
                    t=p;
                    }
                    while (b[u]==k){
                        u--;
                        steps[s][0]=2;
                        steps[s][1]=1;
                        s++;
                    }
                }
            }
            if(t){
                for (int i=0; i<s; i++){
                    out.println(steps[i][0]+" "+steps[i][1]);
                }
            }
            else
            out.println(0);
        }
        catch(Exception e){
            e.printStackTrace();
            System.exit(1);
        }
    }

    public static void main(String[] args){
        new Thread(new Main()).start();
    }

}
