#include <bits/stdc++.h>
using namespace std;
const int maxn = 200001;
vector<int> graph[maxn];
int segment[4 * maxn];
int lazy[4 * maxn];
void push(int node, int l, int r) {
  if (lazy[node]) {
    segment[node] = r - l + 1 - segment[node];
    lazy[node] = 0;
    if (l != r) {
      lazy[node * 2] ^= 1;
      lazy[node * 2 + 1] ^= 1;
    }
  }
}
void update(int node, int l, int r, int L, int R) {
  push(node, l, r);
  if (L > R || l > R || L > r) return;
  if (L <= l && r <= R) {
    lazy[node] ^= 1;
    push(node, l, r);
    return;
  }
  int mid = (l + r) / 2;
  update(node * 2, l, mid, L, R);
  update(node * 2 + 1, mid + 1, r, L, R);
  segment[node] = segment[node * 2] + segment[node * 2 + 1];
}
int query(int node, int l, int r, int L, int R) {
  push(node, l, r);
  if (l > r || l > R || L > r) return 0;
  if (L <= l && r <= R) return segment[node];
  int mid = (l + r) / 2;
  int q1 = query(node * 2, l, mid, L, R);
  int q2 = query(node * 2 + 1, mid + 1, r, L, R);
  return q1 + q2;
}
int in[maxn], out[maxn], cnt = 0;
void dfs(int v) {
  in[v] = ++cnt;
  for (auto i : graph[v]) dfs(i);
  out[v] = cnt;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d", &p);
    graph[p].push_back(i);
  }
  dfs(1);
  for (int i = 1; i <= n; i++) {
    int t;
    scanf("%d", &t);
    if (t) update(1, 1, n, in[i], in[i]);
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    string s;
    int v;
    cin >> s;
    scanf("%d", &v);
    if (s == "get")
      cout << query(1, 1, n, in[v], out[v]) << endl;
    else
      update(1, 1, n, in[v], out[v]);
  }
  return 0;
}
