Magic Squares

No attempts yetTime limit1sMemory limit256 MB

Problem

A magic square is an arrangement of integers in a square grid where the sum of each row, each column, and both main diagonals is the same. The grid has equal numbers of rows and columns. Let mm denote the side length, so the square contains m2m^2 integers. The figure below shows a magic square with m=3m=3.

Input

The first line contains a positive integer nn, the number of test cases. Each test case begins with an integer mm, the side length of the square. The next mm lines each contain mm integers separated by one or more spaces.

Output

For each test case, if the square is a magic square, print Magic square of size m, where mm is the number of rows. Otherwise print Not a magic square.

Constraints

  • 2m52 \leq m \leq 5