#include #include #include using namespace std; void checker(vector& c, int AA, int BB, int CC, int DD, string RR) { if (RR == "NO"){ for (int i = 0; i < 10; i++){ if (i == AA || i == BB || i == CC || i == DD) c[i]++; } } else if (RR == "YES"){ for (int i = 0; i < 10; i++){ if (!(i == AA || i == BB || i == CC || i == DD)) c[i]++; } } } int main() { int N; cin >> N; int A, B, C, D; string R; vectorcheck(10, 0); for (int j = 0; j < N; j++){ cin >> A >> B >> C >> D >> R; checker(check, A, B, C, D, R); } for (int i = 0; i < 10; i++){ if (check[i] == 0){ cout << i << endl; break; } } }