#include #include #include using namespace std; 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; if (R == "NO"){ for (int i = 0; i < 10; i++){ if (i == A || i == B || i == C || i == D) check[i]++; } } else if (R == "YES"){ for (int i = 0; i < 10; i++){ if (i != A && i != B && i != C && i != D) check[i]++; } } } for (int i = 0; i < 10; i++){ if (check[i] == 0){ cout << i << endl; break; } } }