#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 10;
pair<int, int> d[MAXN * 8];
int t = 0;
vector<int> a, tin(MAXN), tout(MAXN), color(MAXN);
vector<vector<int>> g(MAXN);
void dfs(int v, int p = -1) {
  tin[v] = t++;
  a.push_back(v);
  for (auto i : g[v])
    if (i != p) dfs(i, v);
  tout[v] = t++;
  a.push_back(v);
}
void lazy_update(int v, int l, int r) {
  if (!d[v].second) return;
  d[v].second ^= 1;
  d[v * 2 + 1].second ^= 1;
  d[v * 2 + 2].second ^= 1;
  d[v].first = (r - l) - d[v].first;
}
void build(int v = 0, int l = 0, int r = a.size()) {
  if (r - l == 1) {
    d[v].first = color[a[l]];
    return;
  }
  int c = (l + r) / 2;
  build(v * 2 + 1, l, c);
  build(v * 2 + 2, c, r);
  d[v].first = d[v * 2 + 1].first + d[v * 2 + 2].first;
}
void update(int lq, int rq, int v = 0, int l = 0, int r = a.size()) {
  lazy_update(v, l, r);
  if (lq >= r || rq <= l) return;
  if (lq <= l && rq >= r) {
    d[v].second ^= 1;
    lazy_update(v, l, r);
    return;
  }
  int c = (l + r) / 2;
  update(lq, rq, v * 2 + 1, l, c);
  update(lq, rq, v * 2 + 2, c, r);
  d[v].first = d[v * 2 + 1].first + d[v * 2 + 2].first;
}
int request(int lq, int rq, int v = 0, int l = 0, int r = a.size()) {
  lazy_update(v, l, r);
  if (lq >= r || rq <= l) return 0;
  if (l >= lq && r <= rq) {
    return d[v].first;
  }
  int c = (l + r) / 2;
  return request(lq, rq, v * 2 + 1, l, c) + request(lq, rq, v * 2 + 2, c, r);
}
signed main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int temp;
    cin >> temp;
    g[temp - 1].push_back(i + 1);
    g[i + 1].push_back(temp - 1);
  }
  for (int i = 0; i < n; ++i) cin >> color[i];
  dfs(0);
  build();
  for (int i = 0; i < 4; i++) {
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    string s;
    int x;
    cin >> s >> x;
    if (s == "get") {
      cout << (request(tin[x - 1], tout[x - 1] + 1)) / 2 << '\n';
    } else {
      update(tin[x - 1], tout[x - 1] + 1);
    }
  }
  return 0;
}
