let m = 33554432

let split str delim =
  let open String in
  let rec doit s acc =
    match
      try Some (rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i -> doit (sub s 0 i) (sub s (i + 1) (length s - i - 1) :: acc) in
  doit str []

let to_x = Array.make 128 0

let to_key s =
  let n = String.length s in
  let rec doit i acc =
    if i = n then acc
    else doit (i + 1) (4*acc + to_x.(Char.code s.[i])) in
  doit 0 1

let () =
  to_x.(Char.code 'A') <- 0;
  to_x.(Char.code 'C') <- 1;
  to_x.(Char.code 'G') <- 2;
  to_x.(Char.code 'T') <- 3;
  let n = read_int () in
  let t = Array.make m false in
  let rec doit i =
    if i < n then begin
      begin match split (read_line ()) ' ' with
      | ["insert"; s] -> t.(to_key s) <- true
      | ["find"; s] -> print_endline (if t.(to_key s) then "yes" else "no")
      | _ -> ()
      end;
      doit (i + 1)
    end in
  doit 0