const line = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n');

const h = str => {
    return str.split('').map(x => {
        switch(x) {
            case 'A':
                return 1;
            case 'C':
                return 2;
            case 'G':
                return 3;
            case 'T':
                return 4;
        }
    })
    .reduce((acc, x, i) => acc + x*Math.pow(4, i+1));
}

line.slice(1, line.length-1).reduce((acc, x) => {
    const cmd = x.split(' ');
    const key = h(cmd[1]);
    switch(cmd[0]) {
        case 'insert':
            acc[key] = true;
            break;
        case 'find':
            console.log(acc[key] ? 'yes' : 'no');
            break;
    }

    return acc;
}, []);

