read the solution first, then read the grid