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

/*--------構造体定義-------*/
typedef struct wordcard{
 int num;
 struct wordcard *left;
 struct wordcard *right;
}word;
/*--------------------------*/

/*-------文字列を数字へ-------*/
int henkan(char str[]){
int i=0;

while(str[i]!='\0'){
 switch(str[i]){
  case 'A':str[i]='1';
           break;
  case 'C':str[i]='2';
           break;
  case 'G':str[i]='3';
           break;
  case 'T':str[i]='4';
           break;
 }
 i++;
}

return atoi(str);
}
/*--------------------------*/

/*-------単語カード作成----------*/
word* makecell(char str[]){
word *new=malloc(sizeof(word));

new->num=henkan(str);
new->left=NULL;
new->right=NULL;

return new;
}
/*--------------------------------*/


/*------------heap作成--------------------------*/
void insert(word **p,word *q){

if((*p)==NULL)(*p)=q;
else{
 if((*p)->num < q->num)insert(&((*p)->right),q);
 else insert(&((*p)->left),q);
}

return;
}
/*---------------------------------------------*/


/*--------------------find関数-------------------*/
void find(word *p,int x){

while(p!=NULL){
 if(p->num == x){printf("yes\n");return;}
 else if(p->num >x){find(p->left,x);return;}
 else {find(p->right,x);return;}
}

if(p==NULL)printf("no\n");

return;
}

/*---------------------------------------------*/



int main(){
int n,i;
char com[3];
word *new;
word *root;
int x;
word **p;
char temp[13];
word *q;
char y;
int z;

root=NULL;

scanf("%d",&n);

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

 switch(com[0]){
  case 'i':scanf("%s",temp);
           new=makecell(temp);
           insert(&root,new);
           break;
  case 'f':scanf("%s",temp);
           z=henkan(temp);
           find(root,z);
           break;
 }/*switch end*/

}/*for end*/


return 0;
}
