Codeforces Round 928 (Div. 4) |
---|
Finished |
Vladislav has a binary square grid of $$$n \times n$$$ cells. A triangle or a square is drawn on the grid with symbols $$$\texttt{1}$$$. As he is too busy being cool, he asks you to tell him which shape is drawn on the grid.
For the given grid, determine the type of shape that is drawn on it.
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases.
The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 10$$$) — the size of the grid.
The next $$$n$$$ lines each contain $$$n$$$ characters $$$\texttt{0}$$$ or $$$\texttt{1}$$$.
The grid contains exactly one triangle or exactly one square that contains all the $$$\texttt{1}$$$s in the grid. It is guaranteed that the size of the triangle or square is greater than $$$1$$$ (i.e., the shape cannot consist of exactly one 1).
For each test case, output "SQUARE" if all the $$$\texttt{1}$$$s in the grid form a square, and "TRIANGLE" otherwise (without quotes).
630000110114000000000100111021111500111000100000000000000001000000000000000000000000000000000000000000000000000111111111001111111000011111000000111000000001000003111111111
SQUARE TRIANGLE SQUARE TRIANGLE TRIANGLE SQUARE
Name |
---|