using System; using System.Collections.Generic; using System.Linq; using System.Collections; class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); List ios = new List(); BitArray rts = new BitArray(n); for (int i = 0; i < n; i++) { string read = Console.ReadLine(); string rt = read.Substring(8); string inStr = read.Substring(0, 7); string[] ins = inStr.Split(' '); ios.Add(ins); rts[i] = rt == "YES"; } for (int ans = 0; ans < 10; ans++) { bool success = true; for (int j = 0; j < n; j++) { if (ios[j].Contains(ans.ToString()) != rts[j]) { success = false; break; } } if (success) { Console.WriteLine(ans); return; } } } }