Xiao I and Xiao J are playing a game again.
The game is played on an $n \times m$ grid. We describe the cell in the $x$-th row and $y$-th column as $(x, y)$, where $1 \le x \le n$ and $1 \le y \le m$. Initially, at least one cell on the grid is white, and the others are black.
Xiao I and Xiao J take turns, with Xiao I going first. In each turn, the current player must choose exactly one white cell and paint it black.
Two cells are considered adjacent if and only if they share an edge. If, after a move, the cell $(1, 1)$ is not white, or the cell $(n, m)$ is not white, or it is impossible to travel from $(1, 1)$ to $(n, m)$ by moving only through adjacent white cells (i.e., $(1, 1)$ and $(n, m)$ are no longer in the same connected component of white cells), the current player loses, and the other player wins.
As a spectator, you want to determine who will win, assuming both Xiao I and Xiao J play optimally.
Input
The input is read from standard input.
This problem contains multiple test cases. The first line contains an integer $T$ ($1 \le T \le 100$), representing the number of test cases. The following lines describe each test case. For each test case:
- The first line contains two integers $n, m$ ($2 \le n, m \le 1000$), representing the dimensions of the grid.
- The next $n$ lines each contain a string of length $m$ consisting of characters 'B' and 'W', describing the initial state of the grid. A character 'B' at the $i$-th row and $j$-th column means $(i, j)$ is initially black, and 'W' means $(i, j)$ is initially white. It is guaranteed that there is at least one white cell on the initial grid.
It is guaranteed that the sum of $n \times m$ over all test cases in a single test file does not exceed $5 \times 10^6$.
Output
Output to standard output.
For each test case, output a single character on a new line. If Xiao I wins, output 'I'; otherwise, if Xiao J wins, output 'J'.
Examples
Input 1
2
2 2
WB
WW
2 2
WW
WW
Output 1
J
I
Note
For the first test case, Xiao I can only paint $(2, 1)$ black, but painting $(2, 1)$ black makes it impossible to travel from $(1, 1)$ to $(2, 2)$ using only adjacent white cells. Therefore, no matter what move Xiao I makes, they will lose, so the output is 'J'.
For the second test case, Xiao I can paint $(1, 2)$ black, and no matter what move Xiao J makes, they will lose, so the output is 'I'.