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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;
void setprime(bool isprime[], long long n);
long long BinarySearch(long long arr[], long long first, long long last,
                       long long search);
long long choose(long long n, long long k);
void showArray(long long a[], long long n);
long long gcd(long long a, long long b);
long double len(long double x1, long double y1, long double x2, long double y2);
long double gcd_ld(long double x, long double y);
long long power(long long x, long long n);
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed;
  cout << setprecision(6);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  if (a[0] == 3) {
    cout << "NO";
    return 0;
  }
  long long cp1 = 1, cp2 = 2, sp = 3;
  for (long long i = 0; i < n; i++) {
    if (a[i] == cp1 || a[i] == cp2) {
      if (a[i] == cp1) {
        long long tmp = sp;
        sp = cp2;
        cp2 = tmp;
      } else {
        long long tmp = sp;
        sp = cp1;
        cp1 = tmp;
      }
    } else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
void setprime(bool isprime[], long long n) {
  for (long long i = 0; i < n; i++) isprime[i] = true;
  isprime[0] = false;
  isprime[1] = false;
  for (long long i = 2; i < n; i++) {
    for (long long j = 2; i * j < n; j++) isprime[i * j] = false;
  }
}
long long BinarySearch(long long arr[], long long first, long long last,
                       long long search) {
  long long middle = (first + last) / 2;
  while (first <= last) {
    if (arr[middle] < search) {
      first = middle + 1;
    } else if (arr[middle] == search) {
      return middle;
    } else {
      last = middle - 1;
    }
    middle = (first + last) / 2;
  }
  if (first > last) {
    return -1;
  }
}
long long choose(long long n, long long k) {
  if (k == 0) return 1;
  return (n * choose(n - 1, k - 1)) / k;
}
void showArray(long long a[], long long n) {
  for (long long i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long double len(long double x1, long double y1, long double x2,
                long double y2) {
  return sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2));
}
long double gcd_ld(long double x, long double y) {
  long double eps = 0.0001;
  while (fabs(x) > eps && fabs(y) > eps) {
    if (x > y)
      x -= floor(x / y) * y;
    else
      y -= floor(y / x) * x;
  }
  return x + y;
}
long long power(long long x, long long n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return power(x * x, n / 2);
  else
    return x * power(x * x, (n - 1) / 2);
}
