#include #include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n, a, b, c, d; string r; vector ans(10, 1); cin >> n; for (int i = 0; i < n; ++i) { cin >> a >> b >> c >> d >> r; if (r == "YES") { for (int j = 0; j <= 9; ++j) { if (j != a && j != b && j != c && j != d) ans[j] = 0; } } if (r == "NO") { ans[a] = 0; ans[b] = 0; ans[c] = 0; ans[d] = 0; } } for (int i = 0; i < 10; ++i) if (ans[i]) cout << i; return 0; }