Limits 1s, 512 MB

A movie titled "The Shape of Water" won the last Oscar for best picture. But we have nothing to do with that.

In this problem we will see some shapes of geometry.

You will be given a Quadrangular shape in a 2D grid. You have to identify whether it is a "Rectangle" or "Square".

It is guaranteed that there will be exactly one shape and it will be either "Rectangle" or "Square" and the length of the smallest side of that Quadrangular shape will be at least 2.

Input

The first line is the number of test case T (T ≤ 100).

For each test case there will be two numbers N and M (2 ≤ N, M ≤ 100), where N is the number of row and M is the number of column.

The next N lines will contain M characters either "#" or ".".

"#" means: This cell is a part of the Quadrangular shape.

"." means: This cell is not a part of the Quadrangular shape.

Output

For each test case print "Rectangle", if the Quadrangular Shape is a rectangle or "Square", if it is a square.

Sample

InputOutput
2
10 10
..........
..........
.#####....
.#...#....
.#...#....
.#...#....
.#####....
..........
..........
..........
9 10
..........
..........
.#####....
.#...#....
.#...#....
.#...#....
.#...#....
.#####....
..........
Square
Rectangle

Submit

Login to submit.

Statistics

87% Solution Ratio
izNoGoodEarliest, Apr '18
sourav_maloFastest, 0.0s
steinumLightest, 5.5 kB
steinumShortest, 550B
Toph uses cookies. By continuing you agree to our Cookie Policy.