const MAP = {
  'A': 1,
  'C': 2,
  'G': 3,
  'T': 4,
};

const M = 1046527;
let H = [];
for (let i = 0; i < M; i++) H[i] = '';

function getKey(s) {
 let sum = 0;
 for (let i = 0, p = 1; i < s.length; i++, p *= 5) sum += p * MAP[s[i]];
 return sum;
}

function h1(key) { return key % M;}

function h2(key) { return 1 + key % (M - 1);}

function find(s) {
 let key = getKey(s);
 let h;
 const h_1 = h1(key), h_2 = h2(key);
 for (let i = 0;; i++) {
   h = (h_1 + i * h_2) % M;
   if (H[h] === s) return 1;
   else if (H[h] === '') return 0;
 }
 return 0;
}

function insert(s) {
 let key = getKey(s);
 let h;
 const h_1 = h1(key), h_2 = h2(key);
 for (let i = 0;; i++) {
   h = (h_1 + i * h_2) % M;
   if (H[h] === s) return 1;
   else if (H[h] === '') {
     H[h] = s;
     return 0;
   }
 }
 return 0;
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
  const commands = lines.map(l => {
    const cmd = l.split(' ');
    return [cmd[0][0], cmd[1]];
  }).slice(1);

  commands.forEach(cmd => {
    if (cmd[0] === 'i') {
      insert(cmd[1]);
    } else {
      console.log(find(cmd[1]) ? 'yes' : 'no');
    }
  });
})();

