The tests for this problem consist of twelve groups. Points for each group are awarded only if all tests in the group and all tests in some of the previous groups are passed. Note that passing the tests from the statement may not be required for some groups. \textbf{Offline checking} means that the results of testing your solution on this group will only be available after the competition ends.

Let $S$ be the total number of people in the city (the sum of the elements of either table), $A$ be the number of non-zero values $a_{ij}$, and $B$ be the number of non-zero values $b_{ij}$.

{\small

\medskip
\begin{center}
\begingroup
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
& & \multicolumn{4}{c|}{Constraints} & & \\
\cline{3-6}
\raisebox{2.25ex}[0cm][0cm]{Group}
& \raisebox{2.25ex}[0cm][0cm]{Points}
& $M$ & $S$ & $A, B$ & $n$
& \raisebox{2.25ex}[0cm][0cm]{\parbox{1.5cm}{\centering Required}}
& \raisebox{2.25ex}[0cm][0cm]{Comment}
\\
\hline
        0      & 0     & -- & --   & -- & --                                    & --                                    & Samples                    \\ \hline
        1      & 8     & -- & $S \le 7$    & -- & --                            & --                                    &                                      \\ \hline
        2      & 9     & -- & $S \le 50$  & -- & --                               & 1                                      &                                      \\ \hline
        3      & 8    & -- & -- & $A, B \le 13$  & --                            & 1                                      &                                      \\ \hline
        4      & 7     & -- & -- & $A \le 13$    & --                             & 1,\ 3                                  &                                      \\ \hline
        5      & 6     & $m \le 50,\, M \le 5\,000$ & -- & --   & --              & --                                   &                                      \\ \hline
        6      & 10     & $M \le 5\,000 $ & -- & --   & --                        & 5                                      &                                      \\ \hline
        7      & 8     & $M \le 50\,000$ & -- & --  & $n \le 1$              & ---                                    &                                   \\ \hline
        8      & 11    & $M \le 50\,000$  & -- & --     & $n \le 2$          & 7                                      &                                      \\ \hline
        9      & 5     & $M \le 50\,000$  & --  & --   & --          & ---                                    & The answer does not exceed $2$               \\ \hline
        10     & 6     & $M \le 50\,000$ & --  & -- & --              & 9                                      & The answer does not exceed $3$               \\ \hline
        11     & 12    & $M \le 50\,000$   & --  & -- & --            & 5--10                                  &                                      \\ \hline
        12     & 10     & ---          & --   & -- & --                           & 1--11                                  & \textbf{Offline checking}                                     \\ \hline
\end{tabular}
\endgroup
\end{center}
}