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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.io.BufferedReader;import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;


public class Chess {
    
    static StringTokenizer st;
    static BufferedReader sc;
    static PrintWriter pw;
    
    public static void main(String args[]) throws Exception {
        sc = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
            System.out)));
        int n = nextInt();
        
        int [] a = new int[n];
        
        for (int i=0;i<n;i++) {
        	a[i]=nextInt();
        }
        boolean flag=true;
        int p1=1;
        int p2=2;
        int s=3;
        for (int i=0;i<n;i++) {
        	if (a[i]==p1) {
        		int temp=s;
        		s=p2;
        		p2=temp;
        	}
        	if (a[i]==p2) {
        		int temp=s;
        		s=p1;
        		p1=temp;
        	}    	
        	if (a[i]==s) {
        		flag=false;
        		break;
        	}       	
        }
        
        if (flag)
        	pw.println("YES");
        else
        	pw.println("NO");

        pw.close();
        
    } 
    
    public static int calgcd(int a, int b) {
    	while (b!=0) {
    		int temp=b;
    		b = a%b;
    		a = temp;
    		if (b==0) return temp;
    	}
    	return b;
    }
    
    public static int indexOf(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        }
        return -1;
    }
    
    public static boolean istPalindrom(char[] word){
        int i1 = 0;
        int i2 = word.length - 1;
        while (i2 > i1) {
            if (word[i1] != word[i2]) {
                return false;
            }
            ++i1;
            --i2;
        }
        return true;
    }
    
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

/*  private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
*/
    private static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(sc.readLine());
        return st.nextToken();
    }


}





