#include<stdio.h>
#include<string.h>
#define N 12
#define M 1000000
char hash[M][N];

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


int getint(char str[]){
  int sum=0,i,a=1;
  for (i=0;i<strlen(str);i++){
    sum+=a*(getChar(str[i]));
    a*=5;
  }
  return sum;
}

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

void insert(char t[]){
    int i=0,v,j;
    v=getint(t);
    while(1){
        j=h(v,i);
        if(strcmp(hash[j],t)==0)break;
        else if(strlen(hash[j])==0){
            strcpy(hash[j],t);
            break;
        }
        else i++;
    }
}

int search(char t[]){
    int i=0,v,j;
    v=getint(t);
    while(1){
        j=h(v,i);
        if(strcmp(hash[j],t)==0)return 1;
        else if(strlen(hash[j])==0||i>=M)return 0;
        else i++;
    }

}

int main(){
    int i,n,a[N];
    char s[N],t[N];

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s",s,t);
        if(s[0]=='i')insert(t);
        else {
            if(search(t)==0)printf("no\n");
            else printf("yes\n");
        }
    }
  
    return 0;
}

