#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) using namespace std; int main() { int n, a, b, c, d; string r; int x[10] = { 1 }; cin >> n; FOR(i, 0, n) { cin >> a >> b >> c >> d >> r; if (r == "YES") { x[a]++; x[b]++; x[c]++; x[d]++; } else { x[a] = x[b] = x[c] = x[d] = -n; } } int ans = 0; FOR(i, 0, 10) { if (x[i] >= ans) ans = i; } cout << ans << endl; return 0; }