#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 vector> s(6); int main(){ s[0] = {}; int n; cin>>n; if(n<=1){ cout<<"NO"< a(6); rep(i,6)cin>>a[i]; vector t = {0,1,2}; bool F = false; vector xx = {1,3,4,5},yy = {2,2,2,0}; do{ bool f = true; rep(i,4){ int x = xx[i]; int y = yy[i]; if(t[a[x]]>=t[a[y]]){ f= false; break; } } if(t[a[0]]==2&&t[a[1]]==1)f = false; if(f)F = true; } while(next_permutation(t.begin(),t.end())); if(!F)cout<<"NO"<