#include <bits/stdc++.h>
using namespace std;
const int MAX = 200200;
int n, pot;
int first[4 * MAX], type[4 * MAX];
bitset<4 * MAX> updated;
void init() {
  for (int i = pot - 1; i >= 1; i--) first[i] = first[2 * i] + first[2 * i + 1];
}
void sub_update(int node, int l, int r) {
  if (!updated[node]) {
    if (type[node] == 0)
      first[node] = 0;
    else if (type[node] == 1)
      first[node] = (r - l + 1);
    else
      first[node] = (r - l + 1) - first[node];
    updated[node] = true;
    if (node < pot) {
      if (updated[2 * node] || type[node] == 0 || type[node] == 1) {
        updated[2 * node] = false;
        type[2 * node] = type[node];
      } else {
        if (type[2 * node] == 2)
          updated[2 * node] = true;
        else {
          updated[2 * node] = false;
          type[2 * node] = (type[2 * node] + 1) % 2;
        }
      }
      if (updated[2 * node + 1] || type[node] == 0 || type[node] == 1) {
        updated[2 * node + 1] = false;
        type[2 * node + 1] = type[node];
      } else {
        if (type[2 * node + 1] == 2)
          updated[2 * node + 1] = true;
        else {
          updated[2 * node + 1] = false;
          type[2 * node + 1] = (type[2 * node + 1] + 1) % 2;
        }
      }
    }
  }
}
int query(int node, int l, int r, int L, int R) {
  sub_update(node, l, r);
  if (R < l || r < L)
    return 0;
  else if (L <= l && r <= R) {
    return first[node];
  } else
    return query(2 * node, l, (l + r) / 2, L, R) +
           query(2 * node + 1, (l + r) / 2 + 1, r, L, R);
}
void update(int node, int l, int r, int L, int R, int t) {
  sub_update(node, l, r);
  if (R < l || r < L)
    return;
  else if (L <= l && r <= R) {
    updated[node] = false;
    type[node] = t;
    sub_update(node, l, r);
  } else {
    update(2 * node, l, (l + r) / 2, L, R, t);
    update(2 * node + 1, (l + r) / 2 + 1, r, L, R, t);
    first[node] = first[2 * node] + first[2 * node + 1];
  }
}
vector<int> adj[MAX];
int cnt;
int ini[MAX], fn[MAX];
void dfs(int u, int p) {
  ini[u] = cnt++;
  for (__typeof((adj[u]).begin()) v = (adj[u]).begin(); v != (adj[u]).end();
       v++)
    if (*v != p) dfs(*v, u);
  fn[u] = cnt - 1;
}
char s[100];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < int(n - 1); i++) {
    int p;
    scanf("%d", &p);
    p--;
    adj[p].push_back(i + 1);
    adj[i + 1].push_back(p);
  }
  cnt = 0;
  dfs(0, -1);
  updated.set();
  pot = 1;
  while (pot < n) pot *= 2;
  for (int i = 0; i < int(n); i++) scanf("%d", &first[pot + ini[i]]);
  init();
  int Q;
  scanf("%d", &Q);
  for (int q = 0; q < int(Q); q++) {
    int u;
    scanf("%s %d", s, &u);
    u--;
    if (s[0] == 'g') printf("%d\n", query(1, 0, pot - 1, ini[u], fn[u]));
    if (s[0] == 'p') update(1, 0, pot - 1, ini[u], fn[u], 2);
  }
}
