#include <stdio.h>
#include <stdlib.h>
 
char ht[1<<22];
char key[256];
 
int hash(char *str)
{
     
    int h = 1;
    while(*str) h = (h<<2) + key[*str++];
    return h;
}
 
int main()
{
    int n, i, h;
    char com[8], str[13];
    key['C']=1, key['G']=2, key['T']=3;
    scanf("%d", &n);
    for(i=0; i<n; i++) {
        scanf(" %s %s", com, str);
        h = hash(str);
        if(com[0]=='i') ht[h>>3] |= 1<<(h&7);
        else puts((ht[h>>3] & (1<<(h&7)))?"yes":"no");
    }
 
    return 0;
}