Sudoku is a single player number puzzle. You fill a 9x9 grid with digits so that every row, every column, and each of the nine non-overlapping 3x3 sub-matrices holds each digit from 1 to 9 exactly once. The grid starts out partially filled and usually has one solution.


You are given a completed Sudoku grid of size N2×N2. Decide whether it is a valid solution. A valid solution meets all three rules below.
- Every row holds each number from 1 to N2 exactly once.
- Every column holds each number from 1 to N2 exactly once.
- Split the N2×N2 grid into N2 non-overlapping N×N sub-matrices. Every sub-matrix holds each number from 1 to N2 exactly once.
Uniqueness of the puzzle does not matter here. Only check whether the given grid is a valid solution.