import std.algorithm; import std.array; import std.conv; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; int readint() { return readln.chomp.to!int; } int[] readints() { return readln.split.map!(to!int).array; } void main() { bool[10] yes = true; int n = readint(); for (int i = 0; i < n; i++) { auto ss = readln.split; if (ss[$ - 1] == "YES") { auto ts = ss[0 .. $ - 1].map!(to!int).array; ts.sort; foreach (a; iota(0, 10).setDifference(ts)) { yes[a] = false; } } else { foreach (a; ss[0 .. $ - 1].map!(to!int)) { yes[a] = false; } } } foreach (i, x; yes) { if (x) { writeln(i); break; } } }