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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;

public class gg {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int ar[]=new int[n];
		for(int i=0;i<n;i++)
		{
			ar[i]=scan.nextInt();
		}
		//first game =1||2
		if(ar[0]==3){
			System.out.println("NO");
			return;
		}
		// game ==prev winner||3
		int prev=ar[0];
		int spec=0;
		if(prev==1)
		{
			spec=2;
		}else {
			spec=1;
		}
		
		for(int i=1;i<n;i++)
			{
			if(ar[i]==spec)
			{
				System.out.println("NO");
				return;
			}
			if(prev==ar[i])
			{
				for(int k=1;k<=3;k++)
				{
					if(k!=prev&& k!=spec)
					{
						spec=k;
					}
				}
			}else {
				spec=prev;
			}
			prev=ar[i];
			
		}
		System.out.println("YES");
	}
}
