\documentclass{article}
\usepackage{a4,epsfig,acmp,verbatim}

\begin{document}

\titel{D}{Magic Squares}{magic}

A \emph{magic square} is a square matrix of numbers, where the sums of
the numbers in each row, each column, and both main diagonals are the
same.  For instance, the following square is magic with 15 as the
common sum:

\begin{verbatim}
8 3 4
1 5 9
6 7 2
\end{verbatim}

The input file contains several square matrices. You are to find out
whether they are magic.

\section*{Input}

Each test case in your input file starts with a line containing a
single integer $n$ ($1 \le n \le 10$): the number of rows (and
columns) in the square matrix. This is followed by $n$ lines, each
containing $n$ blank-separated integers.

A test case starting with $n=0$ terminates the input. It should not be
processed.

\section*{Output}

For each square, output the line ``\texttt{Square \#$k$:}'', where $k$
is the number of the square. Then, output either ``\texttt{This square
  is magic.}'' or ``\texttt{This square is not magic.}'', depending
whether the square matrix is magic or not.

Output one blank line after each test case.

\section*{Sample Input} \verbatiminput{magic.in}
\section*{Sample Output} \verbatiminput{magic.out}

\end{document}
