#include <cstdio>
#include <cstring>
inline int readint(){
int n = 0;
char ch = getchar();
while(ch < ‘0‘ || ch > ‘9‘) ch = getchar();
while(ch <= ‘9‘ && ch >= ‘0‘){
n = (n << 1) + (n << 3) + (ch++ & 15);
ch = getchar();
}
return n;
}
const int maxn = 250000 + 10;
int len, c[maxn * 2] = {0};
inline void Update(int pos, int val){
for(; pos <= len; pos += pos & -pos) c[pos] += val;
}
inline int Query(int pos){
int s = 0;
for(; pos; pos -= pos & -pos) s += c[pos];
return s;
}
struct Edge{
int to, next;
Edge(){}
Edge(int _t, int _n): to(_t), next(_n){}
}e[maxn];
int fir[maxn] = {0}, cnt = 0;
inline void add(int u, int v){
e[++cnt] = Edge(v, fir[u]); fir[u] = cnt;
}
int in[maxn], out[maxn], Index = 0;
void dfs(int u, int f){
in[u] = ++Index;
Update(in[u], 1);
for(int v, i = fir[u]; i; i = e[i].next){
v = e[i].to;
if(v == f) continue;
dfs(v, u);
}
out[u] = ++Index;
Update(out[u], -1);
}
int main(){
int n = readint();
len = n << 1;
for(int u, v, i = 1; i < n; i++){
u = readint();
v = readint();
add(u, v);
}
dfs(1, 0);
int m = readint() + n - 1;
char opt[3];
for(int a, i = 1; i <= m; i++){
scanf("%s", opt);
a = readint();
if(opt[0] == ‘W‘) printf("%d\n", Query(in[a]) - 1);
else{
a = readint();
Update(in[a], -1);
Update(out[a], 1);
}
}
return 0;
}