Game on Tree
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Alice and Bob are playing a game. Initially, there is a set of string S. Alice and Bob take turns to play, with Alice going first. Each turn, a player can choose a string s from S, remove it from S, and select a character c which appears in s. Then, they remove all occurences of character c from s and divide s into several substrings along these removed positions. They add all non-empty substrings to the set S. The player who cannot make any move loses.

You are now given a tree with n nodes. Each node contains a character. Let {\rm path}(u, v) represent the string formed by concatenating the characters on the shortest path from node u to node v (including nodes u and v). There are q queries, and for each query, given nodes u and v, you need to determine the winner when S = \{{\rm path}(u, v)\}. If Alice wins, also output the number of ways to make the first move.

输入描述:

The first line contains two positive integers, n and q.

The second line contains a string of length n, where the i-th character represents the character at node i.

The next n - 1 lines each contain two positive integers, u and v, describing an edge in the tree.

Following that, there are q lines, each containing two positive integers, u and v, representing a set of queries.

输出描述:

Output q lines in total. For each set of queries, if Alice wins, output \text{Alice} followed by the number of ways to make the first move, separated by a space. Otherwise, output \text{Bob}.
示例1

输入

复制
5 5
01001
2 1
3 1
4 3
5 4
4 5
4 3
1 5
2 5
5 1

输出

复制
Bob
Alice 1
Bob
Alice 1
Bob
示例2

输入

复制
15 15
446397013450369
2 1
3 2
4 3
5 4
6 5
7 5
8 5
9 5
10 5
11 10
12 7
13 6
14 2
15 6
1 13
10 5
7 13
4 2
3 10
9 3
8 3
9 4
2 7
6 5
1 6
4 5
14 3
13 1
9 12

输出

复制
Alice 1
Bob
Bob
Alice 3
Bob
Alice 1
Bob
Alice 1
Alice 5
Bob
Alice 5
Bob
Alice 1
Alice 1
Alice 3

备注:

n \le 5 \times 10^4, q \le 10^5, \Sigma = [0, 9] \cap \mathbf{Z}