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

/**
 * Created by IntelliJ IDEA.
 * User: Enmanuel Reyes
 * Date: 11/23/17
 * Time: 11:08 AM
 * <p>
 * http://codeforces.com/contest/893/problem/A
 */
public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int ns[] = new int[n];
            for (int i = 0; i < n; i++) {
                ns[i] = sc.nextInt();
            }

            Player cannotWin = Player.CARL;
            Player[] players = new Player[4];
            players[1] = Player.ALEX;
            players[2] = Player.BOB;
            players[3] = Player.CARL;

            boolean valid = true;
            for (int i = 0; i < n; i++) {
                final int n1 = ns[i];
                Player won = players[n1];
                if (won == cannotWin) {
                    valid = false;
                    break;
                }
                if (won == Player.ALEX && cannotWin == Player.CARL) {
                    cannotWin = Player.BOB;
                } else if (won == Player.ALEX && cannotWin == Player.BOB) {
                    cannotWin = Player.CARL;
                }else if (won == Player.CARL && cannotWin == Player.BOB) {
                    cannotWin = Player.ALEX;
                }else if (won == Player.BOB && cannotWin == Player.ALEX) {
                    cannotWin = Player.CARL;
                }else if (won == Player.BOB && cannotWin == Player.CARL) {
                    cannotWin = Player.ALEX;
                }else if (won == Player.CARL && cannotWin == Player.ALEX) {
                    cannotWin = Player.BOB;
                }
            }
            if (valid) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        }
    }

}
enum Player{
    Null, ALEX, BOB, CARL
}