Mirko has
For example, if Mirko has
- One friend gets all
red and all green apples; - Two friends each receive
red apples and green apples; - Four friends each receive
red and green apples.
Write a program that outputs all ways for Mirko to divide his apples. Assume Mirko has an infinite supply of friends to give apples to.
Input Specification
The first line contains two positive integers
Output Specification
For each possible distribution, output three integers
Each distribution needs to be output exactly once. You may output the distributions in any order.
Sample Input 1
4 8
Sample Output 1
1 4 8
2 2 4
4 1 2
Sample Input 2
15 12
Sample Output 2
3 5 4
1 15 12
Sample Input 3
42 105
Sample Output 3
1 42 105
3 14 35
7 6 15
21 2 5
Comments
"Assume that Mirko has an infinite supply of friends." Damn must be one cool kid man.