#include <stdio.h>

void insert(int code);
void find(int code);

/*
A:1
C:10
G:100
T:1000
 */

short dictionary[1000000];
int dictLen = 0;

main(){

  int i,j,n;
  char command[7];
  char op[9];
  int code;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",command,op);
    j=0; code=0;
    while(op[j]!='\0'){
      switch(op[j]){
      case 'A':
	code+=1;
	break;
      case 'C':
	code+=9;
	break;
      case 'G':
	code+=81;
	break;
      case 'T':
	code+=729;
	break;
      default:
	break;
      }
      j++;
    }
    if(command[0] == 'i'){ // insert
      insert(code);
    }else if(command[0] == 'f'){ // find
      find(code);
    }
  }

  return 0;

}

void insert(int code){

  dictionary[dictLen++] = code;

}

void find(int code){

  int i;
  for(i=0; i<dictLen; i++){
    if(dictionary[i] == code){
      printf("yes\n");
      return;
    }
  }
  printf("no\n");
  return;

}