#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define Would #define you const int INF = 999999999; const int MOD = 1e9 + 7; const double pi = 3.141592653589793238; bool ban[10]; int main() { int n, a, b, c, d; cin >> n; for (int i = 0; i < n; ++i) { cin >> a >> b >> c >> d; string h; cin >> h; if (h == "NO") { for (int i = 1; i <= 9; ++i) { if (i == a || i == b || i == c || i == d) { ban[i] = 1; } } } else { for (int i = 1; i <= 9; ++i) { if (i != a && i != b && i != c && i != d) { ban[i] = 1; } } } } for (int i = 1; i <= 9; ++i) { if (!ban[i]) { cout << i << endl; } } }