#include using namespace std; #define rep(i,n) for(ll i=0;i=0;i--) #define fi first #define se second #define all(x) (x).begin(),(x).end() #define CST(x) cout<; using vvl=vector>; using pl=pair; template inline bool chmin(T& a, T b){ if(a>b){a = b;return true;}return false;} template inline bool chmax(T& a, T b){ if(a>N; while(N--){ int a,b,c,d;string S;cin>>a>>b>>c>>d>>S; if(S=="YES"){ rep(i,10)if(i!=a and i!=b and i!=c and i!=d)info[i]=0; } else{ info[a]=info[b]=info[c]=info[d]=0; } } rep(i,10)if(info[i])cout<