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;
const int maxn = 1e5 + 10, siz = 320;
struct compressed_edge {
  int v, lazy, total;
  vector<int> compressed_path, group_path, group_size;
  void clear_path() {
    lazy = total = 0;
    for (int i = 0; i < (int)group_path.size(); i++) group_path[i] = 0;
  }
  bool full() {
    if (total == (int)compressed_path.size()) return true;
    total++;
    lazy++;
    return false;
  }
  void down() {
    for (int i = 0; i < (int)group_path.size() && lazy; i++)
      if (group_size[i] - group_path[i] <= lazy) {
        lazy -= group_size[i] - group_path[i];
        group_path[i] = group_size[i];
      } else {
        group_path[i] += lazy;
        for (int j = i * siz;
             j < min(i * siz + siz, (int)compressed_path.size()) && lazy; j++)
          if (!compressed_path[j]) compressed_path[j] = 1, lazy--;
      }
  }
  void update(int gx) {
    if (group_path[gx] == group_size[gx])
      for (int i = gx * siz; i < gx * siz + group_size[gx]; i++)
        compressed_path[i] = 1;
    else if (!group_path[gx])
      for (int i = gx * siz; i < gx * siz + group_size[gx]; i++)
        compressed_path[i] = 0;
  }
  bool add(int x) {
    down();
    int gx = x / siz;
    update(gx);
    for (int i = x; i < min(gx * siz + siz, (int)compressed_path.size()); i++)
      if (!compressed_path[i]) {
        total++;
        compressed_path[i] = 1;
        group_path[gx]++;
        return true;
      }
    for (int i = gx + 1; i < (int)group_path.size(); i++)
      if (group_path[i] < group_size[i]) {
        group_path[i]++;
        total++;
        update(i);
        for (int j = i * siz; j < i * siz + siz; j++)
          if (!compressed_path[j]) {
            compressed_path[j] = 1;
            return true;
          }
      }
    return false;
  }
  void clear_from(int x) {
    down();
    int gx = x / siz;
    update(gx);
    for (int i = x; i < min(gx * siz + siz, (int)compressed_path.size()); i++)
      if (compressed_path[i]) {
        total--;
        compressed_path[i] = 0;
        group_path[gx]--;
      }
    for (int i = gx + 1; i < (int)group_path.size(); i++) {
      total -= group_path[i];
      group_path[i] = 0;
    }
  }
  int access(int x) {
    down();
    update(x / siz);
    return compressed_path[x];
  }
};
int p[maxn], sl[maxn], vt[maxn], n, root[maxn], color[maxn], q;
vector<int> G[maxn], leaf_child[maxn], group_leaf[maxn];
vector<compressed_edge> CG[maxn];
pair<int, int> belong[maxn];
void read() {
  cin >> n >> q;
  for (int i = 2; i <= n; i++) cin >> p[i];
}
void dfs_compressed(int u) {
  for (int i = 0; i < (int)G[u].size(); i++) {
    int v = G[u][i];
    vector<int> cp, gp, gs;
    while (G[v].size() == 1 && leaf_child[v].empty()) {
      vt[v] = cp.size();
      cp.push_back(0);
      if (cp.size() % siz == 1)
        gp.push_back(0), gs.push_back(1);
      else
        gs.back()++;
      belong[v] = make_pair(u, CG[u].size());
      v = G[v][0];
    }
    compressed_edge tmp = {v, 0, 0, cp, gp, gs};
    CG[u].push_back(tmp);
    dfs_compressed(v);
  }
}
void build() {
  for (int i = 1; i <= n; i++) sl[i] = 1;
  for (int i = n; i > 1; i--) sl[p[i]] += sl[i];
  for (int i = 2; i <= n; i++)
    if ((sl[p[i]] <= siz && sl[i] <= siz) || (sl[p[i]] > siz && sl[i] > siz))
      G[p[i]].push_back(i);
    else {
      leaf_child[p[i]].push_back(0);
      if (leaf_child[p[i]].size() % siz == 1) group_leaf[p[i]].push_back(0);
      vt[i] = leaf_child[p[i]].size() - 1;
      root[i] = i;
    }
  dfs_compressed(1);
  for (int i = 1; i <= n; i++)
    if (!root[i]) root[i] = root[p[i]];
}
void updateCG1(int u) {
  if (!color[u]) {
    color[u] = 1;
    return;
  }
  for (int i = 0; i < (int)CG[u].size(); i++)
    if (CG[u][i].full()) updateCG1(CG[u][i].v);
  for (int i = 0; i < (int)group_leaf[u].size(); i++)
    if (group_leaf[u][i] < 0)
      group_leaf[u][i]--;
    else
      group_leaf[u][i]++;
}
void updateG1(int u, int val) {
  if (!val) return;
  if (!color[u]) val--;
  color[u] = 1;
  for (int i = 0; i < (int)G[u].size(); i++) updateG1(G[u][i], val);
}
void updateCG2(int u) {
  color[u] = 0;
  for (int i = 0; i < (int)CG[u].size(); i++) {
    CG[u][i].clear_path();
    updateCG2(CG[u][i].v);
  }
  for (int i = 0; i < (int)group_leaf[u].size(); i++) group_leaf[u][i] = -1;
}
void updateG2(int u) {
  color[u] = 0;
  for (int i = 0; i < (int)G[u].size(); i++) updateG2(G[u][i]);
}
int access_leaf(int u, int x) {
  int gx = x / siz;
  for (int i = gx * siz; i < min((int)leaf_child[u].size(), gx * siz + siz);
       i++)
    if (group_leaf[u][gx] < 0)
      leaf_child[u][i] = group_leaf[u][gx];
    else if (leaf_child[u][i] < 0)
      leaf_child[u][i] -= group_leaf[u][gx];
    else
      leaf_child[u][i] += group_leaf[u][gx];
  group_leaf[u][gx] = 0;
  int tmp = leaf_child[u][x];
  leaf_child[u][x] = 0;
  return tmp;
}
int updateG(int u, int type) {
  int r = root[u], val = access_leaf(p[r], vt[r]);
  if (val < 0) {
    updateG2(r);
    val = -1 - val;
  }
  updateG1(r, val);
  if (type == 1)
    updateG1(u, 1);
  else if (type == 2)
    updateG2(u);
  else
    return color[u];
  return 0;
}
void query1(int u) {
  if (root[u])
    updateG(u, 1);
  else if (belong[u].first)
    CG[belong[u].first][belong[u].second].add(vt[u]);
  else
    updateCG1(u);
}
void query2(int u) {
  if (root[u])
    updateG(u, 2);
  else if (belong[u].first)
    CG[belong[u].first][belong[u].second].clear_from(vt[u]);
  else
    updateCG2(u);
}
int query3(int u) {
  if (root[u])
    return updateG(u, 3);
  else if (belong[u].first)
    return CG[belong[u].first][belong[u].second].access(vt[u]);
  else
    return color[u];
}
void process() {
  int t, x;
  for (int i = 1; i <= q; i++) {
    cin >> t >> x;
    if (t == 1)
      query1(x);
    else if (t == 2)
      query2(x);
    else if (query3(x))
      printf("black\n");
    else
      printf("white\n");
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  read();
  build();
  process();
  return 0;
}