1 #include<iostream>
2 #include<cstdio>
3 #include<cstring>
4 using namespace std;
5
6 struct node
7 {
8 int v;
9 node *next;
10 }point[1000001];
11 node *table[1000000];
12
13 int a[101];
14 int k;
15
16 int hash(int x)
17 {
18 return (x%1000000);
19 }
20
21 void add()
22 {
23 int i,n,h;
24 scanf("%d",&n);
25 for(i=0;i<n;++i,++k)
26 {
27 scanf("%d",&point[k].v);
28 h=hash(point[k].v);
29 node *p=table[h];
30 while(p)
31 {
32 if(p->v==point[k].v)break;
33 p=p->next;
34 }
35 if(!p)
36 {
37 point[k].next=table[h];
38 table[h]=&point[k];
39 }
40 }
41 }
42
43 void query()
44 {
45 int i,n,x,h;
46 scanf("%d",&n);
47 for(i=0;i<n;++i)
48 {
49 scanf("%d",&x);
50 h=hash(x);
51 node *p=table[h];
52 while(p)
53 {
54 if(p->v==x)break;
55 p=p->next;
56 }
57 if(p)printf("YES\n");
58 else printf("NO\n");
59 }
60 }
61
62 int main()
63 {
64 int t;
65 char ch[6];
66 memset(table,0,sizeof(table));
67 k=0;
68 scanf("%d",&t);
69 while(t--)
70 {
71 scanf("%s",ch);
72 if(ch[0]=='A')
73 add();
74 else query();
75 }
76 system("pause");
77 return 0;
78 }