Problem 3189 · Medium
Sort the rook rows and columns separately; the i-th rook row goes to row i, and the same for columns.
Open the interactive visualisation