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
3
3
3
1
1
1
1
3
3
3
3
1
2
3
1
2
2
2
3
3
2
1
3
3
1
2
3
1
1
1
2
2
2
3
1
1
1
1
1
1
3
2
2
2
2
2
2
3
1
2
2
2
2
2
3
3
2
1
1
 3
3
2
2
 3
3
2
3
 2
3
3
 3
2
2
1
 5
1
1
2
2
3
 3
1
3
1
 3
1
1
3

YES
 NO
 NO
 NO
 YES
 NO
 YES
 YES
 NO
 NO
 NO
 YES
 NO
 NO
 YES
 YES
 YES
 NO
 YES
 YES
 NO
 NO
 NO
 NO
 NO
 YES
 YES
 YES
 NO
 NO
 NO
 YES
 NO
 NO
 NO



import java.util.Scanner;

import java.io.BufferedReader;    
import java.io.IOException;    
import java.io.InputStream;    
import java.io.InputStreamReader;    
import java.io.PrintWriter;    
 
    
public class Main {    
    
    static InputReader in;    
    static PrintWriter out;    
    
    /**
     * @param args
     * @throws IOException
     */
    
    static int whol(int p1,int p2,int v)
    {
    	if(v==p1)
    		return p2;
    	if(v==p2)
    		return p1;
    	return -1;
    }
    
    
    
    
       public static void main(String[] args) throws IOException {    
        in = new InputReader(System.in);    
        out = new PrintWriter(System.out);    
        
        int n=in.nextInt();
        int[] arr=new int[n+5];
        int i=n;
        while(--n>=0)
        {
        	arr[i-n-1]=in.nextInt();
        }
        
        boolean flag=true;
        
        int l=whol(1,2,arr[0]);
        int p1=1;
        int p2=2;
        int s=3;
        
        for(int c=1;c<i;++c)
        {
        	
        	if(arr[c]==l)
        	{
        		flag=false;
        		break;
        	}
        	if(p1==l)
        	{
        		int t=p1;
        		p1=s;
        		s=t;
        	}
        	if(p2==l)
        	{
        		int t=p2;
        		p2=s;
        		s=t;
        	}
        	l=whol(p1,p2,arr[c]);
        	        		
        }
        if(flag) out.println("YES");
        
        else out.println("NO");
        
        
        out.close();    
    }    
    
    static class InputReader {    
        BufferedReader br;    
    
        public InputReader(InputStream stream) {    
            br = new BufferedReader(new InputStreamReader(stream));    
        }    
    
        public int nextInt() throws IOException {    
            int c = br.read();    
            while (c <= 32) {    
                c = br.read();    
            }    
            boolean negative = false;    
            if (c == '-') {    
                negative = true;    
                c = br.read();    
            }    
            int x = 0;    
            while (c > 32) {    
                x = x * 10 + c - '0';    
                c = br.read();    
            }    
            return negative ? -x : x;    
        }    
    
        public long nextLong() throws IOException {    
            int c = br.read();    
            while (c <= 32) {    
                c = br.read();    
            }    
            boolean negative = false;    
            if (c == '-') {    
                negative = true;    
                c = br.read();    
            }    
            long x = 0;    
            while (c > 32) {    
                x = x * 10 + c - '0';    
                c = br.read();    
            }    
            return negative ? -x : x;    
        }    
    
        public String next() throws IOException {    
            int c = br.read();    
            while (c <= 32) {    
                c = br.read();    
            }    
            StringBuilder sb = new StringBuilder();    
            while (c > 32) {    
                sb.append((char) c);    
                c = br.read();    
            }    
            return sb.toString();    
        }    
    
        public double nextDouble() throws IOException {    
            return Double.parseDouble(next());    
        }    
    }    
}    
 			  	 	   	    		  		  				 	