defmodule Main do def main do n = IO.gets("") |> String.trim |> String.to_integer IO.stream(:stdio, :line) |> Enum.take(n) |> Enum.map(&String.trim/1) |> Enum.map(&String.split/1) |> Enum.map(&iikanji(&1)) |> Enum.map(&guess(&1)) |> Enum.reduce([0,1,2,3,4,5,6,7,8,9], fn list, acc -> acc -- list end) |> Enum.at(0) |> IO.puts end def iikanji(list) do list |> (fn list -> [Enum.slice(list, 0..-2) |> Enum.map(&String.to_integer/1) , Enum.at(list, -1)] end).() end def guess([head|tail]) when tail == ["YES"] do [0,1,2,3,4,5,6,7,8,9] -- head end def guess([head|tail]) when tail == ["NO"] do head end end