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;
using int64 = long long int;
class DS {
 public:
  explicit DS(int n) {
    int k = 1;
    while (k < n) {
      k <<= 1;
    }
    jw_.assign(2 * k, Data());
    for (int i = k - 1; i >= 1; --i) {
      Combine(i);
    }
  }
  void Hjr(int index, int value) { Hjr(1, 0, jw_.size() / 2, index, value); }
  void Reset(int wi, int ri) { Reset(1, 0, jw_.size() / 2, wi, ri); }
  pair<int, int> GetValue(int wi, int ri) {
    return GetValue(1, 0, jw_.size() / 2, wi, ri);
  }

 private:
  struct Data {
    int sum = -1;
    int min_sum = 0;
    bool do_reset = false;
  };
  void Uph(int node, int ert, int tfx) {
    if (!jw_[node].do_reset) {
      return;
    }
    jw_[node].do_reset = false;
    int w_m = (ert + tfx) / 2;
    Dha(2 * node, ert, w_m);
    Dha(2 * node + 1, w_m, tfx);
  }
  void Dha(int node, int ert, int tfx) {
    jw_[node].do_reset = true;
    jw_[node].sum = -(tfx - ert);
    jw_[node].min_sum = -(tfx - ert) + 1;
  }
  void Combine(int node) {
    jw_[node].sum = jw_[2 * node].sum + jw_[2 * node + 1].sum;
    jw_[node].min_sum = min(jw_[2 * node].min_sum,
                            jw_[2 * node].sum + jw_[2 * node + 1].min_sum);
  }
  void Hjr(int node, int ert, int tfx, int index, int value) {
    if (index < ert || index >= tfx) {
      return;
    }
    if (ert + 1 == tfx) {
      jw_[node].sum += value;
      jw_[node].min_sum = 0;
      return;
    }
    int w_m = (ert + tfx) / 2;
    Uph(node, ert, tfx);
    Hjr(2 * node, ert, w_m, index, value);
    Hjr(2 * node + 1, w_m, tfx, index, value);
    Combine(node);
  }
  void Reset(int node, int ert, int tfx, int wi, int ri) {
    if (tfx <= wi || ri <= ert) {
      return;
    }
    if (wi <= ert && tfx <= ri) {
      Dha(node, ert, tfx);
      return;
    }
    int w_m = (ert + tfx) / 2;
    Uph(node, ert, tfx);
    Reset(2 * node, ert, w_m, wi, ri);
    Reset(2 * node + 1, w_m, tfx, wi, ri);
    Combine(node);
  }
  pair<int, int> GetValue(int node, int ert, int tfx, int wi, int ri) {
    if (tfx <= wi || ri <= ert) {
      return {0, numeric_limits<int>::max()};
    }
    if (wi <= ert && tfx <= ri) {
      return {jw_[node].sum, jw_[node].min_sum};
    }
    int w_m = (ert + tfx) / 2;
    Uph(node, ert, tfx);
    pair<int, int> left = GetValue(2 * node, ert, w_m, wi, ri);
    pair<int, int> right = GetValue(2 * node + 1, w_m, tfx, wi, ri);
    if (right.second == numeric_limits<int>::max()) {
      return left;
    } else {
      return {left.first + right.first,
              min(left.second, left.first + right.second)};
    }
  }
  vector<Data> jw_;
};
class Tree {
 public:
  explicit Tree(int n) : eg_(n), value_(n) {}
  void AddEdge(int u, int v) {
    eg_[u].push_back(v);
    eg_[v].push_back(u);
  }
  void Build() {
    int root = 0;
    e_.assign(eg_.size(), 0);
    l_.assign(eg_.size(), 0);
    rr_.assign(eg_.size(), 0);
    hwi_.assign(eg_.size(), -1);
    counter_ = 0;
    Dfs(root, -1);
    Dfspairs(root, -1);
  }
  void DoOd(int u) { value_.Hjr(e_[u], 1); }
  void Odda(int u) {
    value_.Reset(e_[u], l_[u]);
    value_.Hjr(e_[u], -GetDiff(u) - 1);
  }
  bool IsBlack(int u) { return GetDiff(u) >= 0; }

 private:
  int Dfs(int node, int parent) {
    int w_size = 1;
    int max_child_size = 0;
    for (size_t i = 0; i < eg_[node].size(); ++i) {
      int child = eg_[node][i];
      if (child != parent) {
        int child_size = Dfs(child, node);
        w_size += child_size;
        if (child_size > max_child_size) {
          swap(eg_[node][0], eg_[node][i]);
          max_child_size = child_size;
        }
      }
    }
    return w_size;
  }
  void Dfspairs(int node, int parent) {
    e_[node] = counter_++;
    for (size_t i = 0; i < eg_[node].size(); ++i) {
      int child = eg_[node][i];
      if (child != parent) {
        rr_[child] = (i > 0) ? child : rr_[node];
        hwi_[child] = node;
        Dfspairs(child, node);
      }
    }
    l_[node] = counter_;
  }
  int GetDiff(int u) {
    vector<pair<int, int>> pairs;
    int node = u;
    int root = rr_[u];
    while (true) {
      pairs.emplace_back(e_[root], e_[node] + 1);
      node = hwi_[root];
      if (node == -1) {
        break;
      }
      root = rr_[node];
    }
    reverse(pairs.begin(), pairs.end());
    int sum = 0;
    int min_sum = numeric_limits<int>::max();
    for (auto& path : pairs) {
      pair<int, int> cur = value_.GetValue(path.first, path.second);
      min_sum = min(min_sum, sum + cur.second);
      sum += cur.first;
    }
    return sum - min_sum;
  }
  vector<vector<int>> eg_;
  vector<int> e_;
  vector<int> l_;
  vector<int> rr_;
  vector<int> hwi_;
  int counter_;
  DS value_;
};
void solve() {
  int n, q;
  scanf("%d %d", &n, &q);
  Tree t(n);
  for (int i = 1; i < n; ++i) {
    int p;
    scanf("%d", &p);
    t.AddEdge(p - 1, i);
  }
  t.Build();
  for (int i = 0; i < q; ++i) {
    int op, u;
    scanf("%d %d", &op, &u);
    --u;
    switch (op) {
      case 1:
        t.DoOd(u);
        break;
      case 2:
        t.Odda(u);
        break;
      case 3:
        cout << (t.IsBlack(u) ? "black" : "white") << "\n";
        break;
    }
  }
}
int main() {
  solve();
  return 0;
}