#arc162c. [arc162_c]Mex Game on Tree

[arc162_c]Mex Game on Tree

Problem Statement

You are given a rooted tree with NN vertices numbered 11 to NN. Vertex 11 is the root, and the parent of vertex i(2leqileqN)i\\ (2\\leq i \\leq N) is PiP_i.

Some vertices of the rooted tree have non-negative integers from 00 to NN written on them. This information is given by the sequence A=(A1,A2,ldots,AN)A=(A_1,A_2,\\ldots,A_N). If Aineq1A_i \\neq -1, vertex ii has the integer AiA_i written on it; if Ai=1A_i=-1, vertex ii does not have an integer written on it.

Alice and Bob play a game. Alice goes first, and they take turns performing the following operation until all vertices have an integer written on them.

  • Choose one vertex without an integer written on it and write a non-negative integer between 00 and NN on it.

After the operations, for each vertex vv, let f(v)f(v) be the smallest non-negative integer not written on any vertex (including vv) in the subtree rooted at vertex vv.

If there is a vertex vv such that f(v)=Kf(v) = K, Alice wins. Otherwise, Bob wins. Determine the winner when both players play optimally.

There are TT test cases. Answer each of them.

Constraints

  • 1leqTleq1031 \\leq T \\leq 10^3
  • 2leqNleq1032 \\leq N \\leq 10^3
  • 0leqKleqN0 \\leq K \\leq N
  • 1leqPi<i(2leqileqN)1 \\leq P_i < i\\ (2\\leq i\\leq N)
  • \-1leqAileqN(1leqileqN)\-1 \\leq A_i \\leq N\\ (1\\leq i\\leq N)
  • All input values are integers.
  • The sum of NN over all test cases in a single input is at most 2times1032\\times 10^3.

Input

The input is given from Standard Input in the following format:

TT mathrmcase1\\mathrm{case}_1 vdots\\vdots mathrmcaseT\\mathrm{case}_T

Each case is given in the following format:

NN KK P2P_2 P3P_3 ldots\\ldots PNP_N A1A_1 A2A_2 ldots\\ldots ANA_N

Output

Print TT lines. The ii-th (1leqileqT)(1\\leq i \\leq T) line should contain Alice if Alice wins, and Bob if Bob wins when both players play optimally in the ii-th test case.


Sample Input 1

2
4 2
1 1 2
-1 -1 3 1
6 4
1 2 2 1 3
-1 -1 -1 -1 -1 -1

Sample Output 1

Alice
Bob

In the first test case, if Alice writes 00 on vertex 22, then f(2)=2f(2) = 2 regardless of Bob's operation. Therefore, Alice can win.

In the second test case, Bob can ensure that there will be no vertex with f(v)=4f(v) = 4 by choosing the right integer to write.