func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   struct edge {     int v, nxt;   } g[N];   int tot = 0, head[N];   inline void add(int u, int v) {     g[++tot] = edge{v, head[u]};     head[u] = tot;   }   int n, m, fa[N], sz[N], son[N], top[N], dfn[N], tpos[N], dep[N], cnt = 0;   inline void dfs2(int u, int tp) {     dfn[++cnt] = u;     tpos[u] = cnt;     top[u] = tp;     if (son[u]) dfs2(son[u], tp);     for (int i = head[u]; i; i = g[i].nxt)       if (g[i].v != son[u]) dfs2(g[i].v, g[i].v);   }   int tree[N << 2], mx[N << 2], cov[N << 2];   inline void pushup(int o) {     tree[o] = tree[o << 1] + tree[o << 1 | 1];     mx[o] = max(mx[o << 1 | 1], max(mx[o << 1], 0) + tree[o << 1 | 1]);   }   inline void pushdown(int o, int l, int r) {     if (cov[o]) {       cov[o << 1] = cov[o << 1 | 1] = 1;       int mid = (l + r) >> 1;       tree[o << 1] = -(mid - l + 1);       tree[o << 1 | 1] = -(r - mid);       mx[o << 1] = mx[o << 1 | 1] = -1;       cov[o] = 0;     }   }   inline void update(int p, int o, int l, int r, int x) {     if (l == r) return (void)(tree[o] = mx[o] = x - 1);     int mid = (l + r) >> 1;     pushdown(o, l, r);     mid >= p ? update(p, o << 1, l, mid, x)              : update(p, o << 1 | 1, mid + 1, r, x);     pushup(o);   }   inline void upd(int xl, int xr, int o, int l, int r) {     if (xl <= l && r <= xr)       return (void)(cov[o] = 1, tree[o] = -(r - l + 1), mx[o] = -1);     int mid = (l + r) >> 1;     pushdown(o, l, r);     if (mid >= xl) upd(xl, xr, o << 1, l, mid);     if (mid < xr) upd(xl, xr, o << 1 | 1, mid + 1, r);     pushup(o);   }   struct node {     int tree, mx;   };   inline node operator+(node x, node y) {     node ans;     ans.tree = x.tree + y.tree;     ans.mx = max(y.mx, x.mx + y.tree);     return ans;   }   inline node query(int xl, int xr, int o, int l, int r) {     if (xl <= l && r <= xr) return (node){tree[o], mx[o]};     int mid = (l + r) >> 1;     pushdown(o, l, r);     if (mid >= xl && mid < xr)       return query(xl, xr, o << 1, l, mid) +              query(xl, xr, o << 1 | 1, mid + 1, r);     else if (mid >= xl)       return query(xl, xr, o << 1, l, mid);     else       return query(xl, xr, o << 1 | 1, mid + 1, r);   }   inline node qtree(int u, int v) {     if (!v) return (node){0, 0};     node ans;     bool b = 0;     while (top[u] ^ top[v]) {       if (dep[top[u]] < dep[top[v]]) swap(u, v);       if (b)         ans = query(tpos[top[u]], tpos[u], 1, 1, n) + ans;       else         ans = query(tpos[top[u]], tpos[u], 1, 1, n), b = 1;       u = fa[top[u]];     }     if (dep[u] < dep[v]) swap(u, v);     if (b)       ans = query(tpos[v], tpos[u], 1, 1, n) + ans;     else       ans = query(tpos[v], tpos[u], 1, 1, n), b = 1;     return ans;   }   inline void build(int o, int l, int r) {     if (l == r) return (void)(tree[o] = mx[o] = -1);     int mid = (l + r) >> 1;     build(o << 1, l, mid);     build(o << 1 | 1, mid + 1, r);     pushup(o);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 2; i <= n; ++i) scanf( %d , &fa[i]), add(fa[i], i);     for (int i = n; i >= 1; --i) {       ++sz[i];       sz[fa[i]] += sz[i];       if (sz[i] > sz[son[fa[i]]]) son[fa[i]] = i;     }     for (int i = 1; i <= n; ++i) dep[i] = dep[fa[i]] + 1;     dfs2(1, 1);     build(1, 1, n);     while (m--) {       int t, v;       scanf( %d%d , &t, &v);       if (t == 1) {         node x = query(tpos[v], tpos[v], 1, 1, n);         update(tpos[v], 1, 1, n, x.tree + 2);       } else if (t == 2) {         node x = qtree(1, fa[v]);         upd(tpos[v], tpos[v] + sz[v] - 1, 1, 1, n);         update(tpos[v], 1, 1, n, min(-x.mx, 0));       } else if (t == 3) {         node ans = qtree(1, v);         puts(ans.mx >= 0 ?  black  :  white );       }     }     return 0;   }   