let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  let exprs = content
    .trim()
    .split('\n')
    .slice(1)
    .map(line => line.split(' '));
  
  // s is sorted
  const dict = new Dict();
  for (const [op, arg] of exprs) {
    switch(op) {
      case 'insert': {
        dict.add(arg);
        break;
      }
      case 'find': {
        const found = dict.find(arg);
        console.log(found ? 'yes' : 'no');
      }
    }
  }
});


class Dict {
  constructor() {
    this.hashTable = [];
  }

  add(str) {
    const key = this.getKeyFor(str);
    if (!this.hashTable[key]) {
      this.hashTable[key] = [];
    }

    this.hashTable[key].push(str);
  }

  find(str) {
    const key = this.getKeyFor(str);
    return this.hashTable[key] && this.hashTable[key].includes(str);
  }

  getKeyFor(str) {
    let sum = 0;
    let p = 1;
    for (const s of str) {
      sum += p * this.getKeyForChar(s);
      p *= 5;
    }

    return sum;
  }

  getKeyForChar(char) {
    switch(char) {
      case 'A': return 1;
      case 'C': return 2;
      case 'G': return 3;
      case 'T': return 4;
    }
  }
}
