#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; i++) int main() { cin.tie(nullptr); int N; cin >> N; vector flag(10, true); rep(turn, 0, N) { int A, B, C, D; string R; cin >> A >> B >> C >> D >> R; if (R == "YES") { rep(i, 0, 10) { if (i != A && i != B && i != C && i != D) flag[i] = false; } } else { rep(i, 0, 10) { if (i == A || i == B || i == C || i == D) flag[i] = false; } } } rep(i, 0, 10) { if (flag[i]) cout << i << '\n'; } }