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

int toval( char a ){
  if( a == 'A' ) return 1;
  if( a == 'C' ) return 2;
  if( a == 'G' ) return 3;
  if( a == 'T' ) return 4;
  return 0;
}  

#define TS 10000000

int main(){

  int i, j;
  int n;
  int hash, found;
  char cmd[7], str[13];
  char ht[TS][13]; // hashTable

  memset( ht, '\0', sizeof(ht) );

  scanf( "%d\n", &n );
  

  for( i=0; i<n; i++ ){
    scanf( "%s %s", cmd, str );

    if( cmd[0] == 'i' ){ // insert
      
      // calc hash
      hash = 0;
      for( j=0; j<strlen(str); j++ )
        hash += toval(str[j])*pow(4,j);
      hash = hash%TS;

      // find avaliable space
      for( j=0; j < TS; j++ ){
        if( ht[(hash+j)%TS][0] == '\0' ) break;
      }

      strcpy( ht[(hash+j)%TS], str );

      //printf( " %d[%d+%d] <- %s\n", (hash+j)%TS, hash, j, str );
    }

    if( cmd[0] == 'f' ){ // find

      // calc hash
      hash = 0;
      for( j=0; j<strlen(str); j++ )
        hash += toval(str[j])*pow(4,j);
      hash = hash%TS;

      // find avaliable space
      found = 0;
      for( j=0; j < TS; j++ ){
        if( ht[(hash+j)%TS][0] == '\0' ) break;
        if( strcmp(ht[(hash+j)%TS], str ) == 0 ){
          found++; break;
        }
      }
      
      if( found ) printf( "yes\n" );
      else printf( "no\n" );
    }

  }



  return 0;

}
