Magic squares and cubes