#include <bits/stdc++.h>
using namespace std;
int n, tin[400400], tout[400400], x, q, t[1800800], lazy[1800800], tim, tn = 1,
                                                                        ans;
vector<int> a, g[200200];
string s;
void push(int v, int sz) {
  if (!lazy[v]) return;
  t[v << 1] = sz / 2 - t[v << 1];
  t[(v << 1) + 1] = sz / 2 - t[(v << 1) + 1];
  lazy[v << 1] ^= lazy[v];
  lazy[(v << 1) + 1] ^= lazy[v];
  lazy[v] = 0;
  return;
}
void sum(int v, int tl, int tr, int l, int r) {
  if (tr <= l || r <= tl) return;
  if (l <= tl && tr <= r) {
    ans += t[v];
    return;
  }
  int mid = (tl + tr) / 2;
  push(v, tr - tl);
  sum(v << 1, tl, mid, l, r);
  sum((v << 1) + 1, mid, tr, l, r);
  t[v] = t[v << 1] + t[(v << 1) + 1];
  return;
}
void upd(int v, int tl, int tr, int l, int r) {
  if (tl >= r || tr <= l) return;
  if (l <= tl && tr <= r) {
    lazy[v] ^= 1;
    t[v] = (tr - tl) - t[v];
    return;
  }
  int mid = (tl + tr) / 2;
  push(v, tr - tl);
  upd(v << 1, tl, mid, l, r);
  upd((v << 1) + 1, mid, tr, l, r);
  t[v] = t[v << 1] + t[(v << 1) + 1];
  return;
}
void dfs(int v) {
  tin[v] = tim;
  tim++;
  for (int i = 0; i < g[v].size(); i++) dfs(g[v][i]);
  tout[v] = tim;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  while (tn < n) tn <<= 1;
  for (int i = 1; i < n; i++) {
    cin >> x;
    x--;
    g[x].push_back(i);
  }
  dfs(0);
  for (int i = 0; i < n; i++) cin >> t[tin[i] + tn];
  for (int i = tn - 1; i > 0; i--) t[i] = t[i * 2] + t[i * 2 + 1];
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> s >> x;
    x--;
    if (s == "get") {
      ans = 0;
      sum(1, 0, tn, tin[x], tout[x]);
      cout << ans << endl;
    } else
      upd(1, 0, tn, tin[x], tout[x]);
  }
}
