open System type Sol() = member this.Solve() = let ar = Array.create 10 true let N = stdin.ReadLine() |> int for i = 0 to (N-1) do let S = stdin.ReadLine().Split() match S.[4] with | "NO" -> ( for j = 0 to 3 do ar.[int S.[j]] <- false ) | "YES" -> ( for j = 0 to 9 do if (j <> (int S.[0])) && (j <> (int S.[1])) && (j <> (int S.[2])) && (j <> (int S.[3])) then ar.[j] <- false ) Array.findIndex (fun e -> e = true ) ar |> printfn "%d" let mySol = new Sol() mySol.Solve()