Divide first n square numbers 1^3, 2^3, … n^3 into two groups such that absolute difference of the sum of the two groups is minimum

lets say Given input is n = 3 (n is as large as 100000) My task is to divide {1, 8, 27} into two groups and PRINT these two groups

Possible Solution : dividing groups as {1, 8} and {27} how to print these two groups?