#include #include using namespace std; int main(){ int n; bool num[10]; for(int i = 0;i < 10;i++) num[i] = true; cin >> n; for(int a,b,c,d,i = 0;i < n;i++){ string r; cin >> a >> b >> c >> d >> r; if(r == "YES"){ for(int j = 0;j < 10;j++){ if(j == a || j == b || j == c || j == d) continue; else num[j] = false; } }else num[a] = num[b] = num[c] = num[d] = false; } for(int i = 0;i < 10;i++){ if(num[i]){ cout << i << endl; return 0; } } }