#include <bits/stdc++.h>
using namespace std;
template <class T>
struct SegmentTree {
  inline int m(int left, int right) { return (left + right) >> 1; }
  inline int l(int current) { return 2 * current + 1; }
  inline int r(int current) { return 2 * current + 2; }
  SegmentTree() {}
  SegmentTree(int size)
      : size(size), value(4 * size, 0), delta(4 * size, getNeutralDelta()) {
    init(0, 0, size - 1);
  }
  void init(int root, int left, int right) {
    if (left == right) {
      value[root] = 0;
      delta[root] = getNeutralDelta();
    } else {
      int mid = m(left, right);
      init(l(root), left, mid);
      init(r(root), mid + 1, right);
      value[root] = queryOperation(value[l(root)], value[r(root)]);
      delta[root] = getNeutralDelta();
    }
  }
  void modify(int from, int to, T delta) {
    modify(from, to, delta, 0, 0, size - 1);
  }
  void modify(int from, int to, T delta, int root, int left, int right) {
    if (from == left && to == right) {
      this->delta[root] = joinDeltas(this->delta[root], delta);
      return;
    }
    pushDelta(root, left, right);
    int mid = m(left, right);
    if (from <= mid) modify(from, min(to, mid), delta, l(root), left, mid);
    if (to > mid)
      modify(max(from, mid + 1), to, delta, r(root), mid + 1, right);
    value[root] = queryOperation(
        joinValueWithDelta(
            value[l(root)],
            deltaEffectOnSegment(this->delta[l(root)], mid - left + 1)),
        joinValueWithDelta(
            value[r(root)],
            deltaEffectOnSegment(this->delta[r(root)], right - mid)));
  }
  T query(int from, int to) { return query(from, to, 0, 0, size - 1); }
  T query(int from, int to, int root, int left, int right) {
    if (from == left && to == right)
      return joinValueWithDelta(
          value[root], deltaEffectOnSegment(delta[root], right - left + 1));
    pushDelta(root, left, right);
    int mid = m(left, right);
    if (from <= mid && to > mid)
      return queryOperation(
          query(from, min(to, mid), l(root), left, mid),
          query(max(from, mid + 1), to, r(root), mid + 1, right));
    else if (from <= mid)
      return query(from, min(to, mid), l(root), left, mid);
    else if (to > mid)
      return query(max(from, mid + 1), to, r(root), mid + 1, right);
  }
  T joinValueWithDelta(T value, T delta) {
    if (delta == getNeutralDelta()) return value;
    return modifyOperation(value, delta);
  }
  T joinDeltas(T delta1, T delta2) {
    if (delta1 == getNeutralDelta()) return delta2;
    if (delta2 == getNeutralDelta()) return delta1;
    return modifyOperation(delta1, delta2);
  }
  void pushDelta(int root, int left, int right) {
    value[root] = joinValueWithDelta(
        value[root], deltaEffectOnSegment(delta[root], right - left + 1));
    delta[l(root)] = joinDeltas(delta[l(root)], delta[root]);
    delta[r(root)] = joinDeltas(delta[r(root)], delta[root]);
    delta[root] = getNeutralDelta();
  }
  int size;
  vector<T> value;
  vector<T> delta;
  T modifyOperation(T old, T change) { return change - old; }
  T queryOperation(T leftValue, T rightValue) { return leftValue + rightValue; }
  T deltaEffectOnSegment(T delta, int segmentLength) {
    if (delta == 0) return 0;
    return segmentLength;
  }
  T getNeutralDelta() { return 0; }
};
vector<int> tree[200001];
int nomor[200001];
int until[200001];
int p = 0;
void dfs(int cur, int par) {
  nomor[cur] = p++;
  for (int i = 0; i < tree[cur].size(); i++) {
    if (tree[cur][i] != par) {
      dfs(tree[cur][i], cur);
    }
  }
  until[cur] = (p - 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a;
    cin >> a;
    a--;
    tree[a].push_back(i);
  }
  dfs(0, -1);
  SegmentTree<int> sg(n);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a == 1) sg.modify(nomor[i], nomor[i], a);
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    string s;
    int p;
    cin >> s >> p;
    p--;
    if (s == "get") {
      cout << sg.query(nomor[p], until[p]) << endl;
    } else {
      sg.modify(nomor[p], until[p], 1);
    }
  }
}
