//拉链法
#include <iostream>
#include <cstring>
using namespace std;
const int N = 1e5 + 3;
int h[N],e[N], ne[N], idx;//拉链法,用数组方式代替struct结构方式构造链表,ne[]指向下个结点的位置
void Insert(int x)
{
int t = (x % N+N)%N;//hash值
e[idx] = x;
ne[idx] = h[t];
h[t]=idx++;
}
bool Find(int x)
{
int t = (x % N + N) % N;
for (int i = h[t]; i != -1; i = ne[i])
{
if (e[i] == x)
{
return true;
}
}
return false;
}
int main()
{
int n;
cin >> n;
string op;
int x;
memset(h, -1, sizeof(h));
while(n--)
{
cin >> op>>x;
if ("I" == op)
{
Insert(x);
}
else
{
if (Find(x))
{
cout << "Yes" << endl;
}
else
{
cout << "No" << endl;
}
}
}
return 0;
}
//开放定址法
#include <iostream>
#include <cstring>
using namespace std;
const int N =2e5+3,null= 0x3f3f3f3f;
int h[N];//开放寻址法,数组开操作的2~3倍避免冲突
bool Find(int x);
void Insert(int x)
{
int t = (x % N + N) % N;//hash值
if(!Find(x))//没有重复出现
{
while(h[t] != 0x3f3f3f3f && h[t]!=x && t<=N)
{
t++;
}
h[t] = x;//插入x
}
}
bool Find(int x)
{
int t = (x % N + N) % N;
while (h[t] != 0x3f3f3f3f && h[t] != x && t <= N)
{
t++;
}
if (h[t] == 0x3f3f3f3f)
{
return false;
}
return true;
}
int main()
{
int n;
cin >> n;
string op;
int x;
memset(h, 0x3f, sizeof(h));
while (n--)
{
cin >> op >> x;
if ("I" == op)
{
Insert(x);
}
else
{
if (Find(x))
{
cout << "Yes" << endl;
}
else
{
cout << "No" << endl;
}
}
}
return 0;
}