Problem:
Search III

Your task is to write a program of a simple dictionary which implements the following instructions:

insert str: insert a string str in to the dictionary

find str: if the distionary contains str, then print 'yes', otherwise print 'no'

Input

In the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.

Output

Print yes or no for each find instruction in a line.

Constraints

A string consists of 'A', 'C', 'G', or 'T'

1 ≤ length of a string ≤ 12

n ≤ 1000000

Sample Input 1

5
insert A
insert T
insert C
find G
find A

Sample Output 1

no
yes

Sample Input 2

13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T

Sample Output 2

yes
no
no
yes
yes
yes

Notes

Template in C

Solution in C (judge verdict: Time Limit Exceeded)

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

#define N 500000

typedef struct h{
    char data[13];
struct h *next;
}H;

H table[N];

void init() {
    int i;

    for (i = 0; i < N; i++) {
        table[i].next = NULL;
        *table[i].data = NULL;
    }
}

int hash(char *x) {
    int sum = 0;
    while (*x)
        sum += *x++;
    sum = (sum*sum) / 2 ;
    return (sum+(*--x))%N;
}

int find(char *x) {
    H *p;
    int h;

    h = hash(x);
    for (p = table[h].next; p != NULL; p = p->next)
        if (strcmp(p->data,x) == 0)
            return 1;

    return 0;
}

void insert(char *x) {
    H *p;
    H *New;
    int h;

    if (find(x))
        return;

    if ((New = (H *)malloc(sizeof(H))) == NULL)
        exit(1);

    h = hash(x);
    strcpy(New->data, x);
    p = table[h].next;
    table[h].next = New;
    New->next = p;
}

/*void Delete(char *x) {
    H *p;
    H *q;
    int h;

    h = hash(x);

    for (p = table[h].next, q = &table[h]; p != NULL; q = p, p = p->next)
        if (strcmp(p->data, x) == 0) {
            q->next = p->next;
            break;
        }

    if (p != NULL)
        free(p);
}*/

int main(void) {
    int i, j, n;
    char com[7], data[13];

    init();

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

        if (com[0] == 'i')
            insert(data);
        else if (com[0] == 'f') 
            if (find(data))
                printf("yes\n");
            else
                printf("no\n");
        /*else
            Delete(data);*/
    }
    


    return 0;
}