let m = 1046527

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 p acc =
    if i = n then acc
    else doit (i + 1) (5*p) (acc + p*(to_x.(Char.code s.[i]))) in
  doit 0 1 0

let to_h1 k = k mod m
let to_h2 k = 1 + (k mod (m - 1))

let insert s t =
  let k = to_key s in
  let h1 = to_h1 k in
  let h2 = to_h2 k in
  let rec doit i =
    let h = (h1 + h2*i) mod m in
    if t.(h) = s then ()
    else if t.(h) = "\000" then t.(h) <- s
    else doit (i + 1) in
  doit 0

let find s t =
  let k = to_key s in
  let h1 = to_h1 k in
  let h2 = to_h2 k in
  let rec doit i =
    let h = (h1 + h2*i) mod m in
    if t.(h) = s then true
    else if t.(h) = "\000" then false
    else doit (i + 1) in
  doit 0

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