#include <bits/stdc++.h>
const int maxn = 200000 + 10;
int id[maxn], top[maxn], rk[maxn], depth[maxn], son[maxn], size[maxn],
    father[maxn];
int N, M, tot, cnt, arr[maxn];
struct Node {
  int v;
  Node* next;
};
struct T {
  int num, lazy;
};
T seg[maxn << 2];
Node pool[maxn], *h[maxn];
inline void add(int u, int v) {
  Node* p = &pool[tot++];
  p->v = v, p->next = h[u], h[u] = p;
}
void dfs1(int u) {
  size[u] = 1, depth[u] = depth[father[u]] + 1;
  for (Node* p = h[u]; p; p = p->next) {
    dfs1(p->v);
    size[u] += size[p->v];
    if (size[son[u]] < size[p->v]) {
      son[u] = p->v;
    }
  }
}
void dfs2(int u, int tp) {
  id[u] = ++cnt, top[u] = tp, rk[cnt] = u;
  if (son[u]) dfs2(son[u], tp);
  for (Node* p = h[u]; p; p = p->next) {
    if (p->v == son[u]) continue;
    dfs2(p->v, p->v);
  }
}
inline void pushdown(int l, int r, int cur) {
  if (seg[cur].lazy) {
    int mid = (l + r) >> 1;
    seg[cur << 1].num = (mid - l + 1 - seg[cur << 1].num);
    seg[cur << 1 | 1].num = (r - mid - seg[cur << 1 | 1].num);
    seg[cur << 1].lazy ^= 1;
    seg[cur << 1 | 1].lazy ^= 1;
    seg[cur].lazy = 0;
  }
}
inline void update(int l, int r, int L, int R, int cur) {
  if (l >= L && r <= R) {
    seg[cur].num = (r - l + 1 - seg[cur].num);
    seg[cur].lazy ^= 1;
    return;
  }
  int mid = (l + r) >> 1;
  pushdown(l, r, cur);
  if (mid >= L) {
    update(l, mid, L, R, cur << 1);
  }
  if (mid < R) {
    update(mid + 1, r, L, R, cur << 1 | 1);
  }
  seg[cur].num = seg[cur << 1].num + seg[cur << 1 | 1].num;
}
inline int query(int l, int r, int L, int R, int cur) {
  if (l >= L && r <= R) {
    return seg[cur].num;
  }
  int mid = (l + r) >> 1;
  pushdown(l, r, cur);
  int ans = 0;
  if (mid >= L) {
    ans += query(l, mid, L, R, cur << 1);
  }
  if (mid < R) {
    ans += query(mid + 1, r, L, R, cur << 1 | 1);
  }
  return ans;
}
void build(int l, int r, int cur) {
  if (l == r) {
    seg[cur].num = arr[rk[l]];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, cur << 1);
  build(mid + 1, r, cur << 1 | 1);
  seg[cur].num = seg[cur << 1].num + seg[cur << 1 | 1].num;
}
inline long long read() {
  long long f = 1, r = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') {
      f = -1;
    }
    c = getchar();
  }
  while (isdigit(c)) {
    r = 10 * r + c - '0';
    c = getchar();
  }
  return f * r;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writesp(long long x) { write(x), putchar(' '); }
inline void writeln(long long x) { write(x), puts(""); }
int main() {
  char str[10];
  N = read();
  for (register int i = 2; i <= N; ++i) {
    father[i] = read();
    add(father[i], i);
  }
  for (register int i = 1; i <= N; ++i) {
    arr[i] = read();
  }
  dfs1(1), dfs2(1, 1);
  build(1, N, 1);
  M = read();
  for (int i = 1; i <= M; ++i) {
    scanf("%s", str);
    if (str[0] == 'g') {
      int x = read();
      int ans = query(1, N, id[x], id[x] + size[x] - 1, 1);
      writeln(ans);
    } else {
      int x = read();
      update(1, N, id[x], id[x] + size[x] - 1, 1);
    }
  }
  return 0;
}
