#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; int S = (1<<10)-1,yes = 0; while(N--){ int a,b,c,d; cin >> a >> b >> c >> d; int T = (1<> s; if(s.at(0) == 'Y') S &= T; else S &= ~T; } cout << __builtin_ffs(S)-1 << endl; }