Solution to fill matrix by spiral.