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

#define M 1000000
#define L 14

char A[M][L];
int getChar(char a){
  if(a == 'A') return 1;
  else if(a == 'C') return 2;
  else if(a == 'G') return 3;
  else if(a == 'T') return 4;
  return 0;
}
long long gK(char x[]){
  long long sum = 0, p = 1, i;
  for(i = 0; i < strlen(x); i++ ){
    sum += p*(getChar(x[i]));
    p *= 5;
  }
  return sum;
} 
int h1(int x){ 
  return x % M;
}
int h2(int x){ 
  return 1 + (x % (M - 1));
}
  
int f(char x[]){   
  long long key, i, h;   
  key = gK(x);   
  for ( i = 0;; i++){       
    h = (h1(key) + i * h2(key)) % M;     
    if( strcmp(A[h],x) == 0 )
      return 1;  
    else if(strlen(A[h]) == 0)
      return 0;
  }
  return 0; 
}
  
int insert(char x[]){
   
  long long key, i, h;   
  key = gK(x);   
  for ( i = 0; ; i++ ){     
    h = (h1(key) + i * h2(key)) % M;    
    if( strcmp(A[h],x) == 0 )
      return 1;
    else if(strlen(A[h]) == 0){
      strcpy(A[h],x);
      return 0;
    }
  }
  return 0;
}
  
int main(){
    int i, n, h;
    char x[L], com[9];
    for(i = 0; i < M; i++ ) A[i][0] = '\0';
      
    scanf("%d", &n);
      
    for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, x);
      
    if(com[0] == 'i' ){
        insert(x);
    } else {
        if(f(x)==1){
        printf("yes\n");
        } else {
        printf("no\n");
        }
    }
    }
    return 0;
}