#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
const int OFFSET = 4 * MAXN;
vector<int> adj[MAXN];
int a[MAXN];
int pos[MAXN];
int in[MAXN], out[MAXN];
int tim = 0;
void write(int src = 1) {
  in[src] = ++tim;
  pos[tim] = src;
  for (auto xt : adj[src]) {
    write(xt);
  }
  out[src] = tim;
}
int st[OFFSET];
bool lazy[OFFSET];
void init(int idx, int left, int right) {
  if (left == right) {
    st[idx] = a[pos[left]];
    return;
  }
  init(idx * 2, left, (left + right) / 2);
  init(idx * 2 + 1, (left + right) / 2 + 1, right);
  st[idx] = st[2 * idx] + st[2 * idx + 1];
}
void propagate(int idx, int left, int right) {
  if (lazy[idx]) {
    st[idx] = (right - left + 1) - st[idx];
    if (left != right) {
      lazy[2 * idx] = !lazy[2 * idx];
      lazy[2 * idx + 1] = !lazy[2 * idx + 1];
    }
    lazy[idx] = false;
  }
}
void update(int idx, int left, int right, int l, int r) {
  if (l <= left && right <= r) {
    lazy[idx] = !lazy[idx];
    return;
  }
  if (l <= (left + right) / 2) update(2 * idx, left, (left + right) / 2, l, r);
  if (r > (left + right) / 2)
    update(2 * idx + 1, (left + right) / 2 + 1, right, l, r);
  propagate(2 * idx, left, (left + right) / 2);
  propagate(2 * idx + 1, (left + right) / 2 + 1, right);
  st[idx] = st[2 * idx] + st[2 * idx + 1];
}
int query(int idx, int left, int right, int l, int r) {
  propagate(idx, left, right);
  if (l <= left && right <= r) return st[idx];
  int ret = 0;
  if (l <= (left + right) / 2)
    ret += query(idx * 2, left, (left + right) / 2, l, r);
  if (r > (left + right) / 2)
    ret += query(idx * 2 + 1, (left + right) / 2 + 1, right, l, r);
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d", &p);
    adj[p].push_back(i);
  }
  write();
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  init(1, 1, n);
  int q;
  scanf("%d", &q);
  while (q--) {
    char com[10];
    int v;
    scanf("%s %d", com, &v);
    if (com[0] == 'p')
      update(1, 1, n, in[v], out[v]);
    else
      printf("%d\n", query(1, 1, n, in[v], out[v]));
  }
  return 0;
}
