'use strict';

const main = input => {
  input = input.split('\n');
  const n = Number(input.shift());
  const dic = new Hash();
  for (let i = 0; i < n; ++i) {
    const tmp = input[i].split(' ');
    const c = tmp[0];
    const key = getKey(tmp[1]);
    if (c === 'insert') {
      dic.insert(key);
    } else {
      console.log(dic.search(key) ? 'yes' : 'no');
    }
  }
};

function getChar(ch) {
  if (ch === 'A') return 1;
  else if (ch === 'C') return 2;
  else if (ch === 'G') return 3;
  else if (ch === 'T') return 4;
}

function getKey(str) {
  // let sum = 0;
  // let p = 1;
  // for (let i = 0; i < str.length; i++) {
  //   sum += p * getChar(str[i]);
  //   p *= 5;
  // }
  return parseInt(
    str
      .split('')
      .map(getChar)
      .join(''),
    5
  );
}

const M = 1046527;

class Hash {
  constructor() {
    this.T = [];
  }
  insert(key) {
    let i = 0;
    // eslint-disable-next-line no-constant-condition
    while (true) {
      const j = h(key, i);
      if (!this.T[j]) {
        this.T[j] = key;
        return j;
      } else {
        ++i;
      }
    }
  }
  search(key) {
    let i = 0;
    // eslint-disable-next-line no-constant-condition
    while (true) {
      const j = h(key, i);
      if (this.T[j] === key) {
        return j;
      } else if (this.T[j] === undefined || i >= M) {
        return undefined;
      } else {
        ++i;
      }
    }
  }
}

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

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

function h(key, i) {
  return (h1(key) + i * h2(key)) % M;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

