Decommissioning Duel
The old data center is being shut down, and two on-call engineers, Ada and Ben, are left to power off
whatever is still running. The hall has n racks; rack i still holds a_i live servers.
They settle it with a duel. Ada goes first, then they alternate. On each turn the engineer picks one rack that still has live servers and powers off any positive number of servers in that rack (possibly all of them). Servers in different racks can never be powered off in the same turn. Whoever powers off the very last live server in the hall is spared from writing the postmortem.
Both engineers play optimally. Determine who is spared. If Ada can force a win, also count her winning first moves: a first move is determined by the rack she picks and how many servers she powers off there, and it is winning if, after it, Ada can still force a win however Ben plays.
Each input describes several independent halls.
Input
The first line contains t (1 ≤ t ≤ 10^4), the number of halls.
Each hall is described by two lines. The first contains n (1 ≤ n ≤ 2·10^5), the number of racks.
The second contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9), the number of live servers in
each rack.
The sum of n over all halls does not exceed 2·10^5.
Output
For each hall print one line. If Ada can force a win, print Ada, a space, and the number of her
winning first moves. Otherwise print Ben.
Notes
In the first example, the first hall has a single rack: Ada powers off all 5 servers at once, and that is her only winning move (leaving any server lets Ben finish the rack). In the second hall, whatever Ada does, Ben powers off the last server. In the third hall (racks of 3, 4 and 5 servers) Ada's only winning first move is to power off 2 servers in the first rack, leaving 1, 4 and 5.