Problem: Abendsen assigned a mission to Juliana. In this mission, Juliana has a rooted tree with n vertices. Vertex number 1 is the root of this tree. Each vertex can be either black or white. At first, all vertices are white. Juliana is asked to process q queries. Each query is one of three types:

  1. If vertex v is white, mark it as black; otherwise, perform this operation on all direct sons of v instead. 
  2. Mark all vertices in the subtree of v (including v) as white. 
  3. Find the color of the i-th vertex. 

<image> An example of operation "1 1" (corresponds to the first example test). The vertices 1 and 2 are already black, so the operation goes to their sons instead.

Can you help Juliana to process all these queries?

Input

The first line contains two integers n and q (2≤ n≤ 10^5, 1≤ q≤ 10^5) — the number of vertices and the number of queries.

The second line contains n-1 integers p_2, p_3, …, p_n (1≤ p_i<i), where p_i means that there is an edge between vertices i and p_i. 

Each of the next q lines contains two integers t_i and v_i (1≤ t_i≤ 3, 1≤ v_i≤ n) — the type of the i-th query and the vertex of the i-th query.

It is guaranteed that the given graph is a tree.

Output

For each query of type 3, print "black" if the vertex is black; otherwise, print "white".

Examples

Input

8 10
1 2 1 2 5 4 5
1 2
3 2
3 1
1 1
1 1
3 5
3 7
3 4
2 2
3 5


Output

black
white
black
white
black
white


Input

8 11
1 1 2 3 3 6 6
1 1
1 1
1 3
3 2
3 4
3 6
3 7
2 3
1 6
3 7
3 6


Output

black
white
black
white
white
black

Note

The first example is shown on the picture below.

<image>

The second example is shown on the picture below.

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(register T& t) {
  register T f = 1;
  register char ch = getchar();
  t = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') t = t * 10 + ch - '0', ch = getchar();
  t *= f;
  return t;
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
const long long p = 998244353;
inline long long power(register long long x, register long long k = p - 2) {
  register long long re = 1;
  for (; k; k >>= 1, x = x * x % p)
    if (k & 1) re = re * x % p;
  return re;
}
int n, Q;
int head[100005], ne[200005], to[200005], total = 1;
inline void add(int a, int b) {
  total++;
  to[total] = b;
  ne[total] = head[a];
  head[a] = total;
}
int deep[100005];
int size[100005];
int fa[100005], son[100005];
int id[100005], id_top;
int fid[100005];
int top[100005];
void dfs1(int now) {
  size[now] = 1;
  deep[now] = deep[fa[now]] + 1;
  for (int i = head[now]; i; i = ne[i])
    if (to[i] != fa[now]) {
      fa[to[i]] = now;
      dfs1(to[i]);
      size[now] += size[to[i]];
      if (size[to[i]] > size[son[now]]) son[now] = to[i];
    }
}
void dfs2(int now, int topf) {
  top[now] = topf;
  id[now] = ++id_top;
  fid[id_top] = now;
  if (son[now]) dfs2(son[now], topf);
  for (int i = head[now]; i; i = ne[i])
    if (to[i] != fa[now] && to[i] != son[now]) dfs2(to[i], to[i]);
}
struct SGT {
  int lcs, rcs;
  int Depth, Wal;
  int value;
  int Add_lazy, Rev_lazy;
  bool Cle_lazy;
  int min_Depth_Deep;
  int min_Depth_Wal;
  int min_Deep;
} v[200005];
int tot;
void build(int l, int r, int& p) {
  p = ++tot;
  v[p].Rev_lazy = -1;
  if (l == r)
    return v[p].min_Deep = v[p].min_Depth_Deep = v[p].min_Depth_Wal =
               v[p].value = -deep[fid[l]],
           void();
  build(l, ((l + r) >> 1), v[p].lcs);
  build(((l + r) >> 1) + 1, r, v[p].rcs);
  v[p].min_Deep = min(v[v[p].lcs].min_Deep, v[v[p].rcs].min_Deep);
  v[p].min_Depth_Deep =
      min(v[v[p].lcs].min_Depth_Deep, v[v[p].rcs].min_Depth_Deep);
  v[p].min_Depth_Wal =
      min(v[v[p].lcs].min_Depth_Wal, v[v[p].rcs].min_Depth_Wal);
  v[p].value = min(v[v[p].lcs].value, v[v[p].rcs].value);
  if (v[p].value == v[v[p].lcs].value)
    v[p].Wal = v[v[p].lcs].Wal, v[p].Depth = v[v[p].lcs].Depth;
  if (v[p].value == v[v[p].rcs].value)
    v[p].Wal = v[v[p].rcs].Wal, v[p].Depth = v[v[p].rcs].Depth;
}
void push_down(int l, int r, int p) {
  if (v[p].Rev_lazy != -1) {
    v[v[p].lcs].Rev_lazy = v[p].Rev_lazy;
    v[v[p].rcs].Rev_lazy = v[p].Rev_lazy;
    v[v[p].lcs].Add_lazy = 0;
    v[v[p].rcs].Add_lazy = 0;
    v[v[p].lcs].min_Depth_Deep = v[v[p].lcs].min_Deep + v[p].Rev_lazy;
    v[v[p].rcs].min_Depth_Deep = v[v[p].rcs].min_Deep + v[p].Rev_lazy;
    v[v[p].lcs].value = v[v[p].lcs].min_Depth_Wal + v[p].Rev_lazy;
    v[v[p].rcs].value = v[v[p].rcs].min_Depth_Wal + v[p].Rev_lazy;
    v[v[p].lcs].Depth = v[p].Rev_lazy;
    v[v[p].rcs].Depth = v[p].Rev_lazy;
    v[p].Rev_lazy = -1;
  }
  if (v[p].Add_lazy) {
    v[v[p].lcs].Add_lazy += v[p].Add_lazy;
    v[v[p].rcs].Add_lazy += v[p].Add_lazy;
    v[v[p].lcs].value += v[p].Add_lazy;
    v[v[p].rcs].value += v[p].Add_lazy;
    v[v[p].lcs].Depth += v[p].Add_lazy;
    v[v[p].rcs].Depth += v[p].Add_lazy;
    v[v[p].lcs].min_Depth_Deep += v[p].Add_lazy;
    v[v[p].rcs].min_Depth_Deep += v[p].Add_lazy;
    v[p].Add_lazy = 0;
  }
  if (v[p].Cle_lazy) {
    v[v[p].lcs].Cle_lazy = v[p].Cle_lazy;
    v[v[p].rcs].Cle_lazy = v[p].Cle_lazy;
    v[v[p].lcs].value = v[v[p].lcs].min_Depth_Deep;
    v[v[p].rcs].value = v[v[p].rcs].min_Depth_Deep;
    v[v[p].lcs].Wal = 0;
    v[v[p].rcs].Wal = 0;
    v[v[p].lcs].min_Depth_Wal = v[v[p].lcs].min_Deep;
    v[v[p].rcs].min_Depth_Wal = v[v[p].rcs].min_Deep;
    v[p].Cle_lazy = 0;
  }
}
void push_up(int l, int r, int p) {
  v[p].value = min(v[v[p].lcs].value, v[v[p].rcs].value);
  if (v[p].value == v[v[p].lcs].value)
    v[p].Wal = v[v[p].lcs].Wal, v[p].Depth = v[v[p].lcs].Depth;
  if (v[p].value == v[v[p].rcs].value)
    v[p].Wal = v[v[p].rcs].Wal, v[p].Depth = v[v[p].rcs].Depth;
  v[p].min_Depth_Deep =
      min(v[v[p].lcs].min_Depth_Deep, v[v[p].rcs].min_Depth_Deep);
  v[p].min_Depth_Wal =
      min(v[v[p].lcs].min_Depth_Wal, v[v[p].rcs].min_Depth_Wal);
}
void revise1(int l, int r, int p, int nl, int nr, int vals) {
  if (nl <= l && r <= nr) {
    v[p].value += vals;
    v[p].Depth += vals;
    v[p].min_Depth_Deep += vals;
    v[p].Add_lazy += vals;
    return;
  }
  push_down(l, r, p);
  if (nl <= ((l + r) >> 1)) revise1(l, ((l + r) >> 1), v[p].lcs, nl, nr, vals);
  if (((l + r) >> 1) + 1 <= nr)
    revise1(((l + r) >> 1) + 1, r, v[p].rcs, nl, nr, vals);
  push_up(l, r, p);
}
void revise2(int l, int r, int p, int nl, int nr, int vals) {
  if (nl <= l && r <= nr) {
    v[p].value = v[p].min_Depth_Wal + vals;
    v[p].Depth = vals;
    v[p].min_Depth_Deep = v[p].min_Deep + vals;
    v[p].Add_lazy = 0;
    v[p].Rev_lazy = vals;
    return;
  }
  push_down(l, r, p);
  if (nl <= ((l + r) >> 1)) revise2(l, ((l + r) >> 1), v[p].lcs, nl, nr, vals);
  if (((l + r) >> 1) + 1 <= nr)
    revise2(((l + r) >> 1) + 1, r, v[p].rcs, nl, nr, vals);
  push_up(l, r, p);
}
void revise3(int l, int r, int p, int pos, int vals) {
  if (l == r && l == pos) {
    v[p].Wal = vals;
    v[p].value = v[p].min_Depth_Deep + v[p].Wal;
    v[p].min_Depth_Wal = v[p].min_Deep + vals;
    return;
  }
  push_down(l, r, p);
  if (pos <= ((l + r) >> 1)) revise3(l, ((l + r) >> 1), v[p].lcs, pos, vals);
  if (((l + r) >> 1) + 1 <= pos)
    revise3(((l + r) >> 1) + 1, r, v[p].rcs, pos, vals);
  push_up(l, r, p);
}
void revise4(int l, int r, int p, int nl, int nr) {
  if (nl <= l && r <= nr) {
    v[p].Wal = 0;
    v[p].value = v[p].min_Depth_Deep;
    v[p].min_Depth_Wal = v[p].min_Deep;
    v[p].Cle_lazy = 1;
    return;
  }
  push_down(l, r, p);
  if (nl <= ((l + r) >> 1)) revise4(l, ((l + r) >> 1), v[p].lcs, nl, nr);
  if (((l + r) >> 1) + 1 <= nr)
    revise4(((l + r) >> 1) + 1, r, v[p].rcs, nl, nr);
  push_up(l, r, p);
}
void revise5(int l, int r, int p, int pos, int vals) {
  if (l == r && l == pos) {
    v[p].Wal += vals;
    v[p].value -= vals;
    v[p].min_Depth_Wal -= vals;
    return;
  }
  push_down(l, r, p);
  if (pos <= ((l + r) >> 1)) revise5(l, ((l + r) >> 1), v[p].lcs, pos, vals);
  if (((l + r) >> 1) + 1 <= pos)
    revise5(((l + r) >> 1) + 1, r, v[p].rcs, pos, vals);
  push_up(l, r, p);
}
int enquire(int l, int r, int p, int nl, int nr) {
  if (nl <= l && r <= nr) return v[p].value;
  push_down(l, r, p);
  int re = 1e9;
  if (nl <= ((l + r) >> 1))
    re = min(re, enquire(l, ((l + r) >> 1), v[p].lcs, nl, nr));
  if (((l + r) >> 1) + 1 <= nr)
    re = min(re, enquire(((l + r) >> 1) + 1, r, v[p].rcs, nl, nr));
  return re;
}
int enquire(int l, int r, int p, int pos) {
  if (l == r && l == pos) return v[p].Depth;
  push_down(l, r, p);
  if (pos <= ((l + r) >> 1)) return enquire(l, ((l + r) >> 1), v[p].lcs, pos);
  if (((l + r) >> 1) + 1 <= pos)
    return enquire(((l + r) >> 1) + 1, r, v[p].rcs, pos);
}
int enquire(int x) {
  int re = 1e9;
  while (x) {
    re = min(re, enquire(1, n, 1, id[top[x]], id[x]));
    x = fa[top[x]];
  }
  return re;
}
int main() {
  read(n, Q);
  for (int i = 2, x; i <= n; i++) read(x), add(x, i), add(i, x);
  dfs1(1);
  dfs2(1, 1);
  int root;
  build(1, n, root);
  while (Q--) {
    int opt, x;
    read(opt, x);
    if (opt == 1) {
      revise1(1, n, 1, id[x], id[x] + size[x] - 1, 1);
      revise5(1, n, 1, id[x], 1);
    }
    if (opt == 2) {
      revise4(1, n, 1, id[x], id[x] + size[x] - 1);
      int fmax;
      if (fa[x])
        fmax = enquire(1, n, 1, id[fa[x]]);
      else
        fmax = 0;
      revise2(1, n, 1, id[x], id[x] + size[x] - 1, fmax);
      int mx = enquire(x);
      int mi = enquire(1, n, 1, id[x]);
      int c = mx - mi + deep[x];
      if (c < 0) {
        revise5(1, n, 1, id[x], c);
        revise1(1, n, 1, id[x], id[x], c);
      }
      int X = enquire(1, n, 1, id[x]);
      revise2(1, n, 1, id[x], id[x] + size[x] - 1, X);
    }
    if (opt == 3) {
      int mx = enquire(x);
      int mi = enquire(1, n, 1, id[x]);
      if (mx <= mi - deep[x] - 1)
        printf("black\n");
      else
        printf("white\n");
    }
  }
  return 0;
}