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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.*;
public class B {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int[n];
		for(int i = 0;i<n;i++) {
			a[i] = scan.nextInt();
		}
		if(check(a)) {
			System.out.println("YES");
		}
		else
			System.out.println("NO");
		
		
	}
	
	
	
	public static boolean check(int[] s) {
		int[] play = new int[2];
		play[0] = 1;
		play[1] = 2;
		for(int i = 0;i < s.length;i++) {
			if(s[i] != play[0] && s[i] != play[1]) {
				return false;
			}
			if(s[i] == 1) {
				for(int q = 0;q <= 1;q++) {
					if(play[q] == 2) {
						play[q] = 3;
						continue;
					}
					if(play[q] == 3) {
						play[q] = 2;
						continue;
					}
				}
			}
			if(s[i] == 2) {
				for(int q = 0;q <= 1;q++) {
					if(play[q] == 1) {
						play[q] = 3;
						continue;
					}
					if(play[q] == 3) {
						play[q] = 1;
						continue;
					}
				}
			}
			if(s[i] == 3) {
				for(int q = 0;q <= 1;q++) {
					if(play[q] == 1) {
						play[q] = 3;
						continue;
					}
					if(play[q] == 3) {
						play[q] = 1;
						continue;
					}
				}
			}
			
		}
		if(s[s.length-1] != play[0] && s[s.length-1] != play[1]) {
			return false;
			}
		else {
			return true;
		}
		
	}

}
 	 	   	 		  		 	   	   		 	 		