#include<stdio.h>
#include<string.h>

int Hashinsert(char s){
    if(s=='A')return 1;
    else if(s=='C')return 2;
    else if(s=='G')return 3;
    else if(s=='T')return 4;
    return 0;
}

int main(){
    int hash[500000],n,i,j,h=0;
    char cmd[7],s[12];
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%s %s",cmd,s);
        for(j=0,h=0;s[j]!='\0';j++){
            h+=Hashinsert(s[j])*j;
        }
        if(cmd[0]=='i'){
            hash[h]=1;
        }else{
            if(hash[h]==1)printf("yes\n");
            else printf("no\n");
        }
    }
    
    return 0;
}