group by + beginning in magic square