#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
vector<vector<int> > v(200004);
int ct = -1, lazy[4 * 200004], tree[4 * 200004], t[200004], level[200004],
    in[200004], out[200004];
void dfs(int node, int lev) {
  level[node] = lev;
  in[node] = ++ct;
  int sz = v[node].size();
  for (int j = 0; j < sz; j++) {
    if (level[v[node][j]] == 0) dfs(v[node][j], lev + 1);
  }
  out[node] = ct;
}
void build(int node, int lo, int hi) {
  if (lo > hi) return;
  if (lo == hi) {
    tree[node] = t[lo];
    return;
  }
  int mid = (lo + hi) / 2;
  build(2 * node + 1, lo, mid);
  build(2 * node + 2, mid + 1, hi);
  tree[node] = tree[2 * node + 1] + tree[2 * node + 2];
}
void update(int node, int lo, int hi, int l, int r) {
  if (lazy[node] != 0) {
    tree[node] = (hi - lo + 1) - tree[node];
    if (lo != hi) {
      lazy[2 * node + 1] = 1 - lazy[2 * node + 1];
      lazy[2 * node + 2] = 1 - lazy[2 * node + 2];
    }
    lazy[node] = 0;
  }
  if (lo > hi || lo > r || hi < l) return;
  if (lo >= l && hi <= r) {
    tree[node] = (hi - lo + 1) - tree[node];
    if (lo != hi) {
      lazy[2 * node + 1] = 1 - lazy[2 * node + 1];
      lazy[2 * node + 2] = 1 - lazy[2 * node + 2];
    }
    return;
  }
  int mid = (lo + hi) / 2;
  update(2 * node + 1, lo, mid, l, r);
  update(2 * node + 2, mid + 1, hi, l, r);
  tree[node] = tree[2 * node + 1] + tree[2 * node + 2];
}
int query(int node, int lo, int hi, int l, int r) {
  if (lo > r || lo > hi || hi < l) return 0;
  if (lazy[node] != 0) {
    tree[node] = (hi - lo + 1) - tree[node];
    if (lo != hi) {
      lazy[2 * node + 1] = 1 - lazy[2 * node + 1];
      lazy[2 * node + 2] = 1 - lazy[2 * node + 2];
    }
    lazy[node] = 0;
  }
  if (lo >= l && hi <= r) return tree[node];
  int mid = (lo + hi) / 2;
  return query(2 * node + 1, lo, mid, l, r) +
         query(2 * node + 2, mid + 1, hi, l, r);
}
int main() {
  int n, q;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    v[x].push_back(i);
    v[i].push_back(x);
  }
  dfs(1, 1);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t[in[i]]);
  }
  build(0, 0, n - 1);
  scanf("%d", &q);
  while (q--) {
    char type[5];
    scanf(" %s", type);
    int num;
    scanf("%d", &num);
    if (type[0] == 'g') {
      printf("%d\n", query(0, 0, n - 1, in[num], out[num]));
    } else {
      update(0, 0, n - 1, in[num], out[num]);
    }
  }
  return 0;
}
