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


typedef struct dic{
	int value;
	struct dic* under;
	struct dic* over;
} dictionary;

int getChar(char ch){
	if ( ch == 'A') return 1;
	else if ( ch == 'C') return 2;
	else if ( ch == 'G') return 3;
	else if ( ch == 'T') return 4;
}
int CharValue(char ch[]){
	int ret = 0;
	for(int i = 0;ch[i] != '\0'; i++){
		ret *= 5;
		ret += getChar(ch[i]);
	}
	return ret;
}

int main() {
	int n;
	scanf("%d",&n);

	dictionary first;
	first.value = 0;
	first.under = NULL;
	first.over = NULL;
	
	for(int i = 0; i < n; i++){
		char type[10];
		scanf("%s",type);
		if(strcmp(type,"insert") == 0){
			char value[15];
			if(first.value == 0){
				scanf("%s",value);
				first.value = CharValue(value);
			}else{
				dictionary *p = &first;
				scanf("%s",value);
				int v = CharValue(value);
				for(int quit = 0;quit < 5 ;){
					if(p->value < v){
						if(p->over == NULL){
								//導入
							dictionary *ins;
							if ((ins = (dictionary *) malloc(sizeof(dictionary))) == NULL) {
								break;
							}
							ins->value = v;
							ins->under = NULL;
							ins->over = NULL;
							p->over = ins;
							quit = 10;
						}else{
							p = p->over;
						}
					}else if(p->value > v){
						if(p->under == NULL){
							//導入
							dictionary *ins;
							if ((ins = (dictionary *) malloc(sizeof(dictionary))) == NULL) {
								break;
							}
							ins->value = v;
							ins->under = NULL;
							ins->over = NULL;
							p->under = ins;
							quit = 10;
						}else{
							p = p->under;
						}
					}else{
						quit = 10;
					}
				}
			}
		}else if(strcmp(type,"find") == 0){
			char value[15];
			scanf("%s",value);
			int v = CharValue(value);
			
			dictionary *p = &first;
			
			for(int quit = 0;quit < 5 ;){
				if(p->value < v){
					if(p->over == NULL){
						quit = 10;
						printf("no\n");
					}else{
						p = p->over;
					}
				}else if(p->value > v){
					if(p->under == NULL){
						quit = 10;
						printf("no\n");
					}else{
						p = p->under;
					}
				}else{
					printf("yes\n");
					quit = 10;
				}
				
				
			}
		}
	}
	return 0;
}




