#include using namespace std; int main(){ int i, j; int S[10]; for(j=0;j<=9;j++)S[j] = 1; int n; cin >> n; for(i=0;i> a >> b >> c >> d >> r; if(r == "YES"){ for(j=0;j<=9;j++){ if(j==a)continue; if(j==b)continue; if(j==c)continue; if(j==d)continue; S[j] = 0; } }else{ S[a] = 0; S[b] = 0; S[c] = 0; S[d] = 0; } } for(j=0;j<=9;j++)if(S[j])cout << j << endl; }