#include using namespace std; int main() { int N; cin >> N; vector vec_n(10); //NGのflag管理 vector vec_o(10); //OKのflag管理 for(int a=0; a < N; a++){ int v1,v2,v3,v4; string s; cin >> v1 >> v2 >> v3 >> v4 >> s; if(s == "YES"){ vec_o.at(v1) = 1; vec_o.at(v2) = 1; vec_o.at(v3) = 1; vec_o.at(v4) = 1; } else{ vec_n.at(v1) = 1; vec_n.at(v2) = 1; vec_n.at(v3) = 1; vec_n.at(v4) = 1; } } for(int b=0; b < 10; b++){ if(vec_o.at(b) == 1 && vec_n.at(b) == 0){ cout << b << endl; return 0; } } }