#K50422. Alice's Winning Strategy

    ID: 28861 Type: Default 1000ms 256MiB

Alice's Winning Strategy

Alice's Winning Strategy

Alice and Bob are playing a game with a grid of integers. In each game, the players only consider the positive integers from the grid. They take turns picking the largest available positive integer. Alice always goes first. After all positive integers have been picked, if Alice's total sum is strictly greater than Bob's, then Alice is declared the winner; otherwise, Bob wins.

Your task is to determine the winner for each given grid configuration.

The strategy for both players is simple: since they always pick the largest available positive integer, the outcome is determined by sorting these values in descending order and then distributing them alternately between Alice and Bob.

The mathematical condition for Alice to win can be expressed in LaTeX as:

\(\text{Alice wins if } \sum_{i \text{ even}} v_i > \sum_{i \text{ odd}} v_i\), where \(\{v_i\}\) is the sorted list of positive integers in descending order.

inputFormat

The input is read from standard input (stdin) and has the following format:

T
m₁ n₁
grid[0][0] grid[0][1] ... grid[0][n₁-1]
...
grid[m₁-1][0] ... grid[m₁-1][n₁-1]
...
m_T n_T
grid[0][0] ... grid[0][n_T-1]
...
grid[m_T-1][0] ... grid[m_T-1][n_T-1]

Here, T is the number of test cases. For each test case, the first line contains two integers, m and n, representing the number of rows and columns. This is followed by m lines, each containing n integers, which represent the grid.

outputFormat

For each test case, output a single line to standard output (stdout) that contains either "Alice" if Alice's sum is strictly greater than Bob's, or "Bob" otherwise.

## sample
1
2 2
1 2
3 4
Alice

</p>