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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;
long long x, y, z;
void memset_ll(long long a[], long long v, long long n) {
  for (long long i = 0; i < n; i++) a[i] = v;
}
void memset_s(char a[], char v, long long n) {
  for (long long i = 0; i < n; i++) a[i] = v;
}
int compare(const void* a, const void* b) {
  return (*(long long*)a - *(long long*)b);
}
void q_sort(long long a[], long long n) {
  qsort(a, n, sizeof(long long), compare);
}
static int compare1(const void* a, const void* b) {
  if (*(double*)a > *(double*)b)
    return 1;
  else if (*(double*)a < *(double*)b)
    return -1;
  else
    return 0;
}
void q_sort_d(double a[], long long n) {
  qsort(a, n, sizeof(double), compare1);
}
long long sum(long long n) {
  long long i = 0, a[6], j, k = 0;
  while (n > 0) {
    a[i] = n % 10;
    n /= 10;
    i++;
  }
  for (j = 0; j < i; j++) k += a[j];
  return k;
}
string trans_upper(string ss) {
  transform(ss.begin(), ss.end(), ss.begin(), ::toupper);
  return ss;
}
long long power(long long n, long long m) {
  long long f = 1;
  for (long long i = 0; i < m; i++) {
    f = f * n;
  }
  return f;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t, l, p, q, r, i, j, h, k, e = 0, f = 0, g = 0;
  long long temp = 0, n, m, d = 0, nl, np;
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  p = 1;
  q = 2;
  r = 3;
  for (i = 0; i < n; i++) {
    t = a[i];
    if (t == p || t == q) {
      p = t;
      temp = q;
      q = r;
      r = temp;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
