#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)< void vprint(T &V){ for(auto v : V){ cout << v << " "; } cout << endl; } int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll N; cin >> N; // possibility vector P(10, true); P[0] = false; FOR(i, 0, N){ ll a, b, c, d; string r; cin >> a >> b >> c >> d >> r; vector V; V.push_back(a); V.push_back(b); V.push_back(c); V.push_back(d); map mp; mp[a] = true; mp[b] = true; mp[c] = true; mp[d] = true; if(r=="NO"){ for(ll v : V){ P[v] = false; } }else{ // それ以外をバツ FOR(j, 0, 10){ if(!mp[j]){ P[j] = false; } } } } FOR(i, 1, 10){ if(P[i]){ p(i); return 0; } } return 0; }