#include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; bool ans[11]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b, c, d; string s; cin >> a >> b >> c >> d >> s; if (s == "NO") { ans[a] = true; ans[b] = true; ans[c] = true; ans[d] = true; } else { for (int j = 1; j <= 10; j++) { if (j != a && j != b && j != c && j != d)ans[j] = true; } } bool f = false; int m; for (int j = 1; j <= 10; j++) { if (f == true && ans[j] == false)goto age; if (ans[j] == false) { f = true; m = j; } } cout << m << endl; break; age:; } return 0; }