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

#define LENGTH 12
#define N 1000000

struct node {
    char str[LENGTH + 1];
    struct node* next;
};

struct node *hash[N];

int getChar(char ch) {
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else return 4;
}

long long hash_fnc(char *str){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ) {
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum % N;
}

int h1(int key){ return key % N; }
int h2(int key){ return 1 + (key % (N - 1)); }

void insert(char *s) {
    long long key = hash_fnc(s);
    struct node* p;
    if (hash[key] == NULL) {
        hash[key] = (struct node*)malloc(sizeof(struct node));
        strcpy(hash[key] -> str, s);
        hash[key] -> next = NULL;
    } else {
        for (p = hash[key]; p -> next != NULL; p = p -> next) {
            if (!strcmp(p -> str, s)) return;
        }
        p -> next  = (struct node*)malloc(sizeof(struct node));
        strcpy(p -> next -> str, s);
        p -> next -> next = NULL;
    }
}

int find(char *s) {
    long long key = hash_fnc(s);
    struct node *p;
    if (hash[key] == NULL) {
        return 0;
    } else {
        for (p = hash[key]; p != NULL; p = p -> next) {
            if (!strcmp(p -> str, s)) {
                return 1;
            }
        }
    }
    return 0;
}

int main() {
    int i, n;
    char s[LENGTH + 1], command[7];
    
    for (i=0; i < N; i++) {
        hash[i] = NULL;
    }
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        scanf("%s %s", command, s);
        if (!strcmp(command, "insert")) insert(s);
        else if(find(s)) {
            printf("yes\n");
        } else {
            printf("no\n");   
        }
    }
    
    return 0;
}

