A board contains 48 triangular cells. In each cell is written a digit in a range from 0 through 9. Every cell belongs to two or three lines. These lines are marked by letters from A through L. See the figure below, where the cell containing digit 9 belongs to lines D, G, and I and the cell containing digit 7 belongs to lines B and I.
For each line, we can measure the largest digit on the line. Here the largest digit for line A is 5, B is 7, E is 6, H is 0, and J is 8.
Write a program that reads the largest digit for all 12 of the depicted lines and computes the smallest and the largest possible sums of all digits on the board.
Every line in the input contains 12 digits, each separated by a space. The first of these digits describes the largest digit in line A, the second in line B, and so on, until the last digit denotes the largest one in line L.
For each input line, print the value of the smallest and largest sums of digits possible for the given board. These two values should appear on the same line and be separated by exactly one space. If there does not exists a solution, your program must output “NO SOLUTION''.
5 7 8 9 6 1 9 0 9 8 4 6