#include <bits/stdc++.h>
using namespace std;
using lll = long long;
int main() {
  int n = 0;
  int mas[101];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> mas[i];
  }
  int sled = mas[2];
  int ig = 0;
  {
    int nach = n;
    int a = 1, b = 2, c = 3;
    for (int i = 1; i <= n; i++)
      if (mas[i] == a)
        swap(b, c);
      else if (mas[i] == b)
        swap(a, c);
      else {
        cout << "NO";
        return 0;
      }
  }
  cout << "YES";
  return 0;
}
