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

//I AM THE CREED
/* //I AM THE CREED
/* package codechef; // don't place package name! */
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;
import java.awt.Point;
public class Main{
    static HashMap<Integer, Integer> log=new HashMap<>();
    public static void main(String[] args) throws IOException 
    { 
  
        Scanner input = new Scanner(System.in);
    
        while(input.hasNext()){
            int n=input.nextInt();
            int result=input.nextInt();
            boolean possible=true;
            int loser=0;
            if(result==1){
                loser=2;
            }
            if(result==2){
                loser=1;
            }
            for(int i=1;i<n;i++){
                if(possible==false){
                    input.nextInt();
                    continue;
                }
                result=input.nextInt();
                if(loser==result){
                    possible=false;
                }
               HashSet<Integer> s=new HashSet<>();
                s.add(1);
                s.add(2);
                s.add(3);
                s.remove(loser);
                s.remove(result);
                for(int k:s){
                    loser=k;
                }
                
            }
            if(possible){
                System.out.println("YES");
                continue;
            }
            System.out.println("NO");
        }
    }


}