#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int a = 1;     int b = 2;     bool ok = true;     int k;     for (int i = 0; i < n; i++) {       cin >> k;       if (k != a && k != b) {         ok = false;       } else {         if (b == 3 && a == 1) {           a = min(2, k);           b = max(2, k);         } else if (b == 2 && a == 1) {           a = min(3, k);           b = max(3, k);         } else if (b == 3 && a == 2) {           a = min(1, k);           b = max(1, k);         }       }     }     if (ok) {       cout <<  YES ;     } else {       cout <<  NO ;     }     return 0;   }   