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

#define M 1000000/* your task*/
#define L 14

long IN[4][M];
int m[4]={0,0,0,0},type;

int getChar(char ch){

  return 0;
}

/* convert a string into an integer value */
long getKey(char str[]){
  long sum = 0, p = 1, i,x,s;
  x=strlen(str);
  for ( i = 0; i < x; i++ ){
    if ( str[i] == 'A') s=1;
    else if ( str[i] == 'C') s= 2;
    else if ( str[i] == 'G') s= 3;
    else if ( str[i] == 'T') s= 4;
    sum += s;
    sum *= 10;
  }
  return sum;
}

int find(char str[]){
  int i;
  long f;

  f=getKey(str);
  IN[type][m[type]]=f;
  
  for(i=0;f!=IN[type][i];i++){}
  
  if(i==m[type]) return -1;  
  return 0;  
}

int insert(char str[]){
  /* your task */
  IN[type][m[type]++]=getKey(str);
  return 0;
}

int main(){
    int i, n;
    char str[L], com[9];
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
      scanf("%s %s", com, str);
      if ( str[0] == 'A') type=0;
      else if ( str[0] == 'C') type= 1;
      else if ( str[0] == 'G') type= 2;
      else if ( str[0] == 'T') type= 3;
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)==0){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

