#include <bits/stdc++.h>
using namespace std;
int in[300002];
int out[300002];
int timer;
int kx[300002];
int a[300002];
int tr[1048576][2];
int sh[1048576];
vector<int> g[300002];
void dfs(int p, int u) {
  timer++;
  in[u] = timer;
  kx[timer] = u;
  for (int i = 0; i < g[u].size(); i++)
    if (g[u][i] != p) dfs(u, g[u][i]);
  out[u] = timer;
}
void build(int t, int l, int r) {
  if (l == r) {
    tr[t][a[kx[l]]]++;
    return;
  }
  build(2 * t, l, (l + r) / 2);
  build(2 * t + 1, (l + r) / 2 + 1, r);
  tr[t][0] = tr[2 * t][0] + tr[2 * t + 1][0];
  tr[t][1] = tr[2 * t][1] + tr[2 * t + 1][1];
}
int get(int t, int l, int r, int L, int R) {
  if (r < L || R < l) return 0;
  if (L <= l && r <= R) return tr[t][1];
  if (sh[t]) {
    sh[2 * t] = 1 - sh[2 * t];
    sh[2 * t + 1] = 1 - sh[2 * t + 1];
    swap(tr[2 * t][0], tr[2 * t][1]);
    swap(tr[2 * t + 1][0], tr[2 * t + 1][1]);
    sh[t] = 0;
  }
  return get(2 * t, l, (l + r) / 2, L, R) +
         get(2 * t + 1, (l + r) / 2 + 1, r, L, R);
}
void upd(int t, int l, int r, int L, int R) {
  if (r < L || R < l) return;
  if (L <= l && r <= R) {
    swap(tr[t][0], tr[t][1]);
    sh[t] = 1 - sh[t];
    return;
  }
  if (sh[t]) {
    sh[2 * t] = 1 - sh[2 * t];
    sh[2 * t + 1] = 1 - sh[2 * t + 1];
    swap(tr[2 * t][0], tr[2 * t][1]);
    swap(tr[2 * t + 1][0], tr[2 * t + 1][1]);
    sh[t] = 0;
  }
  upd(2 * t, l, (l + r) / 2, L, R);
  upd(2 * t + 1, (l + r) / 2 + 1, r, L, R);
  tr[t][1] = tr[2 * t][1] + tr[2 * t + 1][1];
  tr[t][0] = tr[2 * t][0] + tr[2 * t + 1][0];
}
int n, x, i, m;
string s;
int main() {
  cin >> n;
  for (i = 2; i <= n; i++) {
    scanf("%d", &x);
    g[x].push_back(i);
  }
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  dfs(0, 1);
  build(1, 1, n);
  cin >> m;
  while (m--) {
    cin >> s;
    scanf("%d", &x);
    if (s == "get") {
      printf("%d\n", get(1, 1, n, in[x], out[x]));
    } else {
      upd(1, 1, n, in[x], out[x]);
    }
  }
}
