#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

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

#define NUM (244140624)
int str[NUM+1];

int convert(char *operand){
    int i;
    char c;
    int ans = 0;
    int digit = 1;
    int len = strlen(operand);
    
    for (i=0; i < len; i++) {
        c = operand[i];
        
        switch (c) {
            case 'A':
                ans = ans + digit * 1;
                break;
            case 'G':
                ans = ans + digit * 2;
                break;
            case 'C':
                ans = ans + digit * 3;
                break;
            case 'T':
                ans = ans + digit * 4;
                break;
            default:
                break;
        }
        digit = digit * 5;
    }
    return ans;
}

void insert(char *operand){
    int num = convert(operand);
    str[num] = 1;
}


int find(char *operand){
    int num = convert(operand);
    if (str[num]) {
        return 1;
    }
    return 0;
}

void initdic(){
    int i = 0;
    for (i=0; i<NUM; i++) {
        str[i] = 0;
    }
    
}


int main(){
    
    int i,n;
    char operator[20];
    char operand[20];
    char c;
    
    //the number
    scanf("%d",&n);
    
    initdic();
    
    for (i=0; i < n; i++) {
        scanf("%s %s",operator, operand);
        
        c = operator[0];
        switch (c) {
            case 'i':
                insert(operand);
                break;
                
            case 'f':
                if (find(operand)) {
                    printf("yes\n");
                }
                else{
                    printf("no\n");
                }
                
                break;
            default:
                break;
        }
        
    }
    
    return 0;
}