An and Bình have a positive integer X and want to split it into the sum of two positive integers A and B. The true value of a positive integer is not in its magnitude but is determined by the sum of its digits. The two friends will be happy if A and B have equal digit sums.
Objective: There are T test cases, each providing a positive integer X. For each test case, help An and Bình find two positive integers A and B such that they add up to X and have equal digit sums.
Input:
4
4
33
243
29
Output:
2 2
12 21
117 126
-1
Let C(X) and S(X) denote the number of digits and the digit sum of the positive integer X.
Color board | |
Digit sum | |
Sequences of sum k |
Digit sum | |
Sequence division | |
Colorful board |
Digit sum | |
Sequences of sum k | |
Sequence division |