407580: GYM102832 H Combination Lock

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Combination Locktime limit per test4.0 smemory limit per test256 megabytesinputstandard inputoutputstandard output

Once there was a combination lock, which consisted of $$$m$$$ rings with digits from $$$0$$$ to $$$9$$$. It was broken so one could never open the lock no matter how he spun it. Alice and Bob wanted to play a game with it. They in turn spun one ring of the lock for one step in either direction, and tried to open the lock (although they knew the lock would never open). If the password on the lock had already been tried, the player would be considered lost. Additionally, they had discussed a set $$$S$$$ of $$$n$$$ passwords before the game started. The player would also lose if (s)he tried a password among $$$S$$$. Alice would move first.

A $$$5$$$-digit combination lock

Now you can only recall $$$m$$$, $$$S$$$ and the initial password on the lock, and you wonder who was the winner supposing Alice and Bob played optimally.

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$T$$$ ($$$1 \le T \le 10$$$). Description of the test cases follows.

The first line contains two integers $$$m$$$ and $$$n$$$ ($$$1 \leq m \leq 5$$$, $$$0 \leq n < 10^m$$$), and a string $$$t$$$ ($$$|t| = m$$$) composed of digits from $$$0$$$ to $$$9$$$, representing the initial password on the lock.

The $$$i$$$-th of the next $$$n$$$ lines contains a string $$$u_i$$$ ($$$|u_i| = m$$$) composed of digits from $$$0$$$ to $$$9$$$, representing a password in $$$S$$$. It is guaranteed that all $$$u_i$$$ are distinct, and not the same as $$$t$$$.

Output

For each test case, print on a line Alice or Bob, the winner of the game.

ExampleInput
3
5 3 30583
29348
80064
09637
1 2 6
7
5
1 2 9
1
8
Output
Bob
Bob
Alice

加入题单

上一题 下一题 算法标签: