class dict =
  let m = 1104427 in
  let d =  Array.init (m+1) (fun x-> "") and
      h1 key = key mod m and
      h2 key = 1 + (key mod (m-1)) and
      get_char ch = match ch with
          'A' -> 1
        | 'C' -> 2
        | 'G' -> 3
        | 'T' -> 4
        | _ -> 0
  in
  object (self: 'self)

    method get_key str =
      let rec key s = function
          i when i = String.length str -> s
        | i -> key (s + get_char str.[i]) (i+1)
      in key 0 0

    method contains str =
      let key = self#get_key str in
      let rec loop i =
        let h = (h1 key + i * (h2 key)) mod m in
        if d.(h) = str then true
        else if d.(h) = "" then false
        else
          loop (i+1)
      in loop 0

    method add str  =
      let key = self#get_key str in
      let rec loop i =
        let h = (h1 key + i * (h2 key)) mod m in
        if d.(h) = "" then d.(h) <- str
        else if d.(h) = str then ()
        else loop (i+1)
      in loop 0
  end;;

let () =
  let n = read_int () and
      d = new dict
  in
  let rec read = function
      0 -> ()
    | i ->
       let line = read_line () |> Str.split (Str.regexp " ") |> Array.of_list in
       if line.(0) = "insert" then
         d#add line.(1)
       else if line.(0) = "find" then
         if d#contains line.(1) then print_endline "yes"
         else print_endline "no"
       ;read (i-1)
  in read n;;