You are given a grid of letters with $m$ rows and $n$ columns, together with a list of words. For each word, find where it appears in the grid.
A word appears in the grid if its letters lie along a straight, uninterrupted line of grid cells. Matching is case-insensitive. The line may run in any of the eight directions: horizontally (left or right), vertically (up or down), or along either diagonal.
The first line contains a single integer $T$, the number of test cases.
Each test case has the following form:
For each word, output two integers separated by a single space: the row and column of the cell that holds the first letter of the word.
Rows are numbered from $1$ (top) to $m$ (bottom); columns from $1$ (left) to $n$ (right).
If a word occurs more than once, report the occurrence whose first letter is closest to the top of the grid; if several are equally high, report the leftmost among them. In other words, choose the first-letter cell that comes earliest in row-major order (top to bottom, then left to right).
If a word does not appear at all, output $m$ and $n$ instead.
Print the results of one test case on consecutive lines, and separate the outputs of different test cases with a single blank line.