module SS = Set.Make(String);;

let _ =
  let n = read_int () and
      s = SS.empty
  in
  let rec read s = function
      0 -> ()
    | i ->
       let line = read_line () |> Str.split (Str.regexp " ") |> Array.of_list in
       if line.(0) = "insert" then
         read (SS.add line.(1) s) (i-1)
       else if line.(0) = "find" then
         begin
           if SS.mem line.(1) s then print_endline "yes"
           else print_endline "no"
          ;read s (i-1)
         end
  in read s n;;