function len(t) local r = 0 for k,v in pairs(t) do r = r + 1 end return r end print((function (y, n) for i=0,9 do n[tostring(i)] = true end for _=1,tonumber(io.stdin:read("*l")) do local s = io.stdin:read("*l") if s:sub(9) == "NO" then s:gsub("%d", function (e) n[e] = nil end) else if next(y) == nil then s:gsub("%d", function (e) y[e] = true end) else for k,_ in pairs(y) do if s:find(k) == nil then y[k],n[k] = nil,nil end end s:gsub("%d", function (e) if y[e] == nil then n[e] = nil end end) end end end return string.format("%s", next(len(y) == 1 and y or n)) end)({}, {}))