//Aizu - ALDS1_4_C
#include <bits/stdc++.h>
#define sd(n) scanf("%d", &n)
#define pd(n) printf("%d\n", n)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define INF 0x3f3f3f3f
#define NIL (-1)
using namespace std;
typedef long long LL;
const int maxn = 1e6 + 5;
int n;
char T[maxn][13];
int getChar(char c)
{
if (c == 'A') return 1;
else if (c == 'C') return 2;
else if (c == 'G') return 3;
else if (c == 'T') return 4;
return 0;
}
LL getKey(char* str)
{
LL sum = 0, p = 1;
for (int i = 0; i < strlen(str); i++) {
sum += p * getChar(str[i]);
p *= 5;
}
return sum;
}
int h1(int key) { return key % maxn; }
int h2(int key) { return 1 + (key % maxn); }
int find(char* str)
{
LL key = getKey(str);
for (int i = 0; ; i++) {
LL h = (h1(key) + i * h2(key)) % maxn;
if (strcmp(T[h], str) == 0) return 1;
else if (strlen(T[h]) == 0) return 0;
}
return 0;
}
int insert(char* str)
{
LL key = getKey(str);
for (int i = 0; ; i++) {
LL h = (h1(key) + i * h2(key)) % maxn;
if (strcmp(T[h], str) == 0) return 1;
else if (strlen(T[h]) == 0) {
strcpy(T[h], str);
return 0;
}
}
}
int main()
{
int t;
cin >> t;
while (t--) {
char op[35], str[15];
scanf("%s", op);
scanf("%s", str);
if (op[0] == 'i') {
insert(str);
}
else if (op[0] == 'f') {
int j = find(str);
if (j) printf("yes\n");
else printf("no\n");
}
}
return 0;
}