#include<stdio.h>
#include<string.h>
#define M 100000
typedef struct DIC{
  char coma[10];
  char key[12];
  int c;
}D;

D D1[M],D2[M],D3[M],D4[M];
static int t1=0,t2=0,t3=0,t4=0;
int hash(char *v){
  int h;
  if(v[0]=='A')return 1; 
  else if(v[0]=='C')return 2;
  else if(v[0]=='G')return 3;
  else return 4;
}

void insert(D d){
  if(hash(d.key)==1){
    strcpy(D1[t1].key,d.key);
    t1++;
  }
  else if(hash(d.key)==2){
    strcpy(D2[t2].key,d.key);
    t2++;
  }
  else if(hash(d.key)==3){
    strcpy(D3[t3].key,d.key);
    t3++;
  }
  else{
    strcpy(D4[t4].key,d.key);
    t4++;
  }
}

int search(D d){
  int i;
  if(hash(d.key)==1){
    for(i=0;i<t1;i++){
      if(strcmp(D1[i].key,d.key)==0)
	return 0;
    }
    return 1;
  }
  else if(hash(d.key)==2){
    for(i=0;i<t2;i++){ 
      if(strcmp(D2[i].key,d.key)==0)
	return 0;
    }
    return 1;
  }
  else if(hash(d.key)==3){
    for(i=0;i<t3;i++){ 
      if(strcmp(D3[i].key,d.key)==0)
	return 0;
    }
    return 1;
  }
  else if(hash(d.key)==4){
    for(i=0;i<t4;i++){ 
      if(strcmp(D4[i].key,d.key)==0)
	return 0;
    }
    return 1;
  } 
}
main(){
  D Dic[M];
  int n,i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",Dic[i].coma,Dic[i].key);
    if(Dic[i].coma[0]=='i')
      insert(Dic[i]);
    else
      if(search(Dic[i])==0)
	printf("yes\n");
      else
	printf("no\n");
  }
  return 0;
}