#include #include #include #include #include #include #include #include #include #include #include #include #include #include #pragma GCC optimize("O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma comment(linker, "STACK:36777216") using namespace std; using i64 = int64_t; constexpr i64 MOD = 1e9 + 7; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); using vi = vector; using vvi = vector; using vvvi = vector; using ii = pair; int main() { int n; cin >> n; vi ans(10, 1); for (int i = 0; i < n; i++) { int a, b, c, d; cin >> a >> b >> c >> d; string s; cin >> s; if (s == "NO") { ans[a] &= 0; ans[b] &= 0; ans[c] &= 0; ans[d] &= 0; } else { ans[a] &= 1; ans[b] &= 1; ans[c] &= 1; ans[d] &= 1; } } for (int i = 1; i < 10; i++) { if (ans[i]) { cout << i << endl; } } }