#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e9;
const long double eps = 1e-9;
const long double pi = acos(-1);
const long long int mod = 1000000007;
long long int powmod(long long int a, long long int b) {
  long long int res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 200005;
int n, arr[N], par[N], lo[N], hi[N], eulerpath[N], ticks, lazy[4 * N],
    tree[4 * N];
vector<int> adj[N];
void dfs(int v) {
  lo[v] = ++ticks;
  eulerpath[ticks] = v;
  for (auto it : adj[v]) dfs(it);
  hi[v] = ticks;
}
void build(int node, int be, int en) {
  if (be > en) return;
  if (be == en) {
    tree[node] = arr[eulerpath[be]];
    return;
  }
  int mid = (be + en) >> 1;
  build((2 * (node)), be, mid);
  build((2 * (node) + 1), mid + 1, en);
  tree[node] = tree[(2 * (node))] + tree[(2 * (node) + 1)];
}
void update(int node, int be, int en, int l, int r) {
  if (be > en) return;
  if (lazy[node] != 0) {
    tree[node] = (en - be + 1) - tree[node];
    if (be != en) {
      lazy[(2 * (node))] ^= 1;
      lazy[(2 * (node) + 1)] ^= 1;
    }
    lazy[node] = 0;
  }
  if (be > r || l > en) {
    return;
  }
  if (be >= l && en <= r) {
    tree[node] = (en - be + 1) - tree[node];
    if (be != en) {
      lazy[(2 * (node))] ^= 1;
      lazy[(2 * (node) + 1)] ^= 1;
    }
    return;
  }
  int mid = (be + en) >> 1;
  update((2 * (node)), be, mid, l, r);
  update((2 * (node) + 1), mid + 1, en, l, r);
  tree[node] = tree[(2 * (node))] + tree[(2 * (node) + 1)];
}
int query(int node, int be, int en, int l, int r) {
  if (be > en) return 0;
  if (lazy[node] != 0) {
    tree[node] = (en - be + 1) - tree[node];
    if (be != en) {
      lazy[(2 * (node))] ^= 1;
      lazy[(2 * (node) + 1)] ^= 1;
    }
    lazy[node] = 0;
  }
  if (be > r || en < l) return 0;
  if (be >= l && en <= r) return tree[node];
  int mid = (be + en) >> 1;
  int a = query((2 * (node)), be, mid, l, r);
  int b = query((2 * (node) + 1), mid + 1, en, l, r);
  return a + b;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int i;
  cin >> n;
  for (i = 2; i <= n; ++i) {
    cin >> par[i];
    adj[par[i]].push_back(i);
  }
  for (i = 1; i <= n; ++i) cin >> arr[i];
  dfs(1);
  build(1, 1, n);
  int q;
  cin >> q;
  while (q--) {
    int v;
    string str;
    cin >> str >> v;
    if (str[0] == 'g')
      cout << query(1, 1, n, lo[v], hi[v]) << '\n';
    else
      update(1, 1, n, lo[v], hi[v]);
  }
  return 0;
}
