#B4211. The Triangle Sides Game

    ID: 11868 Type: Default 1000ms 256MiB

The Triangle Sides Game

The Triangle Sides Game

Two senior students, X and Y, invented a simple digital game to entertain their juniors. Student Y secretly chooses three positive integers \(A, B, C\) satisfying \(2 \leq A \leq B \leq C\) and such that these three numbers can be the side lengths of a triangle (i.e. \(A+B > C\)). Instead of disclosing \(A, B, C\) directly, he announces 4 positive integers \(x_1, x_2, x_3, x_4\). He claims that each \(x_i\) is one of the seven numbers in the set

{A,  B,  C,  A+B,  A+C,  B+C,  A+B+C}.\{A,\; B,\; C,\; A+B,\; A+C,\; B+C,\; A+B+C\}.

Moreover, Y is truthful: the four numbers he provides are guaranteed to be a sub-multiset of the seven numbers above for at least one valid triple \((A,B,C)\). Your task is to find all ordered triples \((A,B,C)\) that could have been chosen by Y such that the multiset of generated numbers contains all of the given four numbers (taking multiplicities into account). If there are more than one valid triple, output them in lexicographical order (first by \(A\), then \(B\), then \(C\)), each triple on one line with the three numbers separated by a single space.

inputFormat

The input consists of 4 positive integers \(x_1, x_2, x_3, x_4\) separated by spaces.

outputFormat

Output all valid triples \(A\;B\;C\) (separated by spaces) that satisfy the conditions. Each triple should be printed on a new line. It is guaranteed that at least one valid triple exists.

sample

3 4 5 7
2 3 4