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

#define MAX 1000000
#define len 12

char hash[MAX][len];

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

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

int find(char str[]){
  int key = getKey(str);
  int i, j;
  for(i=0;i<MAX;i++){
      j=(key%MAX+i*(1+key%(MAX-1)))%MAX;
      if(strcmp(str, hash[j])==0)return j;
    }
  return '\0';
}

int insert(char str[]){
  int key = getKey(str);
  int i, j;
  for(i=0;i<MAX;i++){
      j=(key%MAX+i*(1+key%(MAX-1)))%MAX;
      if(hash[j][0]=='\0'){
          strcpy(hash[j], str);
          return j;
        }
    }
  return -1;
}

int main(){
    int i, n, h;
    char str[len], com[8];
    for ( i = 0; i < MAX; i++ ) hash[i][0] = '\0';
    scanf("%d", &n);
   
    for ( i = 0; i < n; i++ ){
        scanf("%s %s", com, str);
       
        if ( com[0] == 'i' ){
            insert(str);
        } else {
            if (find(str)){
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    return 0;
}