#include #include //#include using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 100000000000; using namespace std; int main() { int n; int target=0; std::vector dp(10); cin>>n; REP(i,n){ std::vector num(4); REP(j,4){ cin>>num[j]; } string R; cin>>R; if(R=="YES"){ REP(j,4){ dp[num[j]]++; target++; } } else{ REP(j,4){ dp[num[j]]--; } } } REP(i,10){ if(dp[i]==target){print(i);} } }