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

#include <bits/stdc++.h>
using namespace std;
int main() {
  int number_games, alex_spec = 1, carl_spec = 0, bob_spec = 1, i = 0;
  cin >> number_games;
  int times_win[number_games];
  while (i < number_games) {
    cin >> times_win[i];
    i++;
  }
  i = 1;
  while (i < number_games) {
    if (times_win[i - 1] == 1 && times_win[i] == 1 && bob_spec == 1) {
      bob_spec = 0;
      carl_spec = 1;
    } else if (times_win[i - 1] == 1 && times_win[i] == 3 && bob_spec == 1) {
      bob_spec = 0;
      alex_spec = 1;
    } else if (times_win[i - 1] == 2 && times_win[i] == 2 && alex_spec == 1) {
      alex_spec = 0;
      carl_spec = 1;
    } else if (times_win[i - 1] == 2 && times_win[i] == 3 && alex_spec == 1) {
      alex_spec = 0;
      bob_spec = 1;
    } else if (times_win[i - 1] == 3 && times_win[i] == 3 && bob_spec == 1) {
      bob_spec = 0;
      alex_spec = 1;
    } else if (times_win[i - 1] == 3 && times_win[i] == 1 && bob_spec == 1) {
      bob_spec = 0;
      carl_spec = 1;
    } else if (times_win[i - 1] == 3 && times_win[i] == 3 && alex_spec == 1) {
      alex_spec = 0;
      bob_spec = 1;
    } else if (times_win[i - 1] == 3 && times_win[i] == 2 && alex_spec == 1) {
      alex_spec = 0;
      carl_spec = 1;
    } else if (times_win[i - 1] == 1 && times_win[i] == 1 && carl_spec == 1) {
      carl_spec = 0;
      bob_spec = 1;
    } else if (times_win[i - 1] == 2 && times_win[i] == 2 && carl_spec == 1) {
      carl_spec = 0;
      alex_spec = 1;
    } else if (times_win[i - 1] == 1 && times_win[i] == 2 && carl_spec == 1) {
      carl_spec = 0;
      alex_spec = 1;
    } else if (times_win[i - 1] == 2 && times_win[i] == 1 && carl_spec == 1) {
      carl_spec = 0;
      bob_spec = 1;
    } else if (times_win[0] == 3 || times_win[1] == 3) {
      printf("NO\n");
      return (0);
    } else {
      printf("NO\n");
      return (0);
    }
    i++;
  }
  printf("YES\n");
  return (0);
}
