/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.c
 * Author: kundaikwangwari
 *
 * Created on June 30, 2019, 8:32 PM
 */

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

#define L 14
#define M 1500047 /* your task*/ //how big should my hash table be

char H[M][L]; /* Hash Table */

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;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  //printf("sum is %lld\n",sum);
  return sum;
}

int h1(int key){ 
    int value = key % M;
    return value;
}

int h2(int key){ 
    int value = 1 + (key% (M-1));
    return value; }

int find(char str[]){

    long long k = getKey(str);
    for(int i = 0; ;i++){
        long long key = (h1(k) + i*h2(k))%M;
        if(H[key][0] == '\0')return 0; //the search failed
        if(strcmp(H[key],str) == 0)return 1;
        //break statement or condition
    //insert str into hash table
    //H[key][str];
    /* your task */
    }
}

int insert(char str[]){

    long long k = getKey(str);
    for(int i = 0; ;i++){
        long long key = (h1(k) + i*h2(k))%M;
        if(H[key][0] == '\0'){
            //printf("key is %lld\n",key);
            strcpy(H[key],str);
            return 1;
    } 
        //break statement or condition
    //insert str into hash table
    //H[key][str];
    /* your task */
    }
    
}
/*
 * 
 */
int main(int argc, char** argv) {

    
    
    int n, h;
    char str[L], com[9];
    for (int i = 0;i < M; i++)H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for (int 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;
}

