solve magic-square