A puzzle game clears three candies of the same color that sit next to each other in a row or in a column. The candies come in six colors: blue, yellow, green, orange, purple, and red. They sit in a grid of horizontal rows and vertical columns. Once a player has moved a candy and a set has been cleared, the game itself has to find the sets that are left.
Write a program that finds one set of three candies of the same color that sit next to each other in a row or in a column, and prints the position of each of the three candies. Rows are numbered from 1 starting at the top, and columns are numbered from 1 starting at the left.
A grid can hold several sets. List a horizontal set from left to right and a vertical set from top to bottom, then print the set whose six numbers r1,c1,r2,c2,r3,c3 form the smallest sequence in lexicographic order. That rule picks the set whose first candy comes earliest in row-major order, and when a horizontal set and a vertical set start at the same candy it picks the horizontal one.
The first line holds the number of test cases T (1≤T≤20).
Each test case starts with a line holding the number of rows R and the number of columns C (1≤R,C≤100). The next R lines each hold C letters separated by spaces. One letter is the color of one candy: B is blue, Y is yellow, G is green, O is orange, P is purple, and R is red.
Blank lines may appear between test cases.
Print one line for each test case. If the grid holds at least one set, print the row and the column of each of the three candies of the chosen set as r1 c1 r2 c2 r3 c3, separated by spaces. If the grid holds no set, print no set found.