#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
struct Node {
  int c0, c1;
  int painted;
};
vector<int> g[MAXN];
pair<int, int> seg[MAXN];
int sz;
Node t[4 * MAXN];
int a[MAXN], p[MAXN];
void dfs(int v) {
  sz++;
  seg[v] = {sz, sz};
  for (auto to : g[v]) {
    dfs(to);
    seg[v].second = seg[to].second;
  }
}
void build(int v, int tl, int tr) {
  if (tl == tr) {
    if (a[p[tl]] == 0) {
      t[v].c0 = 1;
    } else {
      t[v].c1 = 1;
    }
    t[v].painted = 0;
  } else {
    int tm = (tl + tr) / 2;
    build(v * 2, tl, tm);
    build(v * 2 + 1, tm + 1, tr);
    t[v].painted = 0;
    t[v].c0 = t[v * 2].c0 + t[v * 2 + 1].c0;
    t[v].c1 = t[v * 2].c1 + t[v * 2 + 1].c1;
  }
}
void push(int v) {
  if (!t[v].painted) return;
  t[v].painted = 0;
  t[v * 2].painted ^= 1;
  t[v * 2 + 1].painted ^= 1;
  swap(t[v * 2].c0, t[v * 2].c1);
  swap(t[v * 2 + 1].c0, t[v * 2 + 1].c1);
}
void update(int v, int tl, int tr, int l, int r) {
  if (tl == l && tr == r) {
    t[v].painted ^= 1;
    swap(t[v].c0, t[v].c1);
  } else {
    int tm = (tl + tr) / 2;
    push(v);
    if (tm >= r) {
      update(v * 2, tl, tm, l, r);
    } else if (tm < l) {
      update(v * 2 + 1, tm + 1, tr, l, r);
    } else {
      update(v * 2, tl, tm, l, tm);
      update(v * 2 + 1, tm + 1, tr, tm + 1, r);
    }
    t[v].c0 = t[v * 2].c0 + t[v * 2 + 1].c0;
    t[v].c1 = t[v * 2].c1 + t[v * 2 + 1].c1;
  }
}
int query(int v, int tl, int tr, int l, int r) {
  if (tl == l && tr == r) {
    return t[v].c1;
  } else {
    int tm = (tl + tr) / 2;
    push(v);
    if (tm >= r) {
      return query(v * 2, tl, tm, l, r);
    }
    if (tm < l) {
      return query(v * 2 + 1, tm + 1, tr, l, r);
    }
    return query(v * 2, tl, tm, l, tm) +
           query(v * 2 + 1, tm + 1, tr, tm + 1, r);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    g[x].push_back(i);
  }
  sz = 0;
  dfs(1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    p[seg[i].first] = i;
  }
  build(1, 1, n);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    string type;
    int v;
    cin >> type >> v;
    if (type == "get") {
      cout << query(1, 1, n, seg[v].first, seg[v].second) << "\n";
    } else {
      update(1, 1, n, seg[v].first, seg[v].second);
    }
  }
  return 0;
}
