## Summary

Two perfect logicians, A and B, play a game. It begins with a fish bowl containing some number, N, of M&Ms and a dead fish. There is no water in the bowl. That’s how the fish died. The two players alternate turns. In one turn a player must remove some number in \([1, 2, . . . , M]\) M&Ms. The object of the game is to leave your opponent with the dead fish.

Given N and M,(2 ≤ M < N ≤ 1000), and the name of the starting player (either A or B), you only have to decide who wins.

## Input

The first line of input contains a single decimal integer P,(1 ≤ P ≤ 500), which is the number of datasets that follow. Each dataset should be processed identically and independently. Each dataset consists one line of input containing the problem number K, then two integers N and M and the character A or B. The four fields are separated by single spaces.

```
2
1 10 4 A
2 8 3 B
```

## Output

For each dataset there is one line of output containing the problem number, then a space, then the name of the winning player.

```
1 B
2 A
```