import std.stdio, std.string, std.conv ,std.array, std.algorithm, std.range ,std.math; void main(){ auto N = readln().strip().to!int(); bool[10] fl; fl[] = true; foreach(int i; 0 .. N) { auto buf = readln().strip().split(); if(buf[4]=="NO") { foreach(int j; 0 .. 4) { fl[buf[j].to!int] = false; } } else { bool[10] t; foreach(int j; 0 .. 4) { t[buf[j].to!int] = true; } foreach(int j; 0 .. 10) { if(!t[j]) { fl[j] = false; } } } } foreach(int i; 0 .. 10) { if(fl[i]) { writeln(i); return; } } }