Mirko recently got
crayons as a gift. The color of each crayon is a combination of three primary colors: red, green and blue. The color of the
crayon is represented with three integers:
for the red,
for the green and
for the blue component.
The difference between the
and the
crayon is
. The colorfulness of a subsequence of crayons is equal to the largest difference between any two crayons in the subsequence.
Mirko needs a subsequence with
crayons with the smallest colorfulness for his drawing. The subsequence does not have to be consecutive. Find it!
Input Specification
The first line of input contains integers
and
.
The
of the following
lines contains three integers
,
and
.
Output Specification
The first line of output should contain the smallest colorfulness of a subsequence with
crayons.
The following
lines should contain the
,
and
values of the colors of the crayons in the subsequence, in any order. Any subsequence that yields the smallest colorfulness will be accepted.
Scoring
In test cases worth
of total points,
will hold.
In test cases worth additional
of total points,
will hold.
Sample Input 1
Copy
2 2
1 3 2
2 6 4
Sample Output 1
Copy
3
1 3 2
2 6 4
Sample Input 2
Copy
3 2
3 3 4
1 6 4
1 1 2
Sample Output 2
Copy
2
3 3 4
1 1 2
Sample Input 3
Copy
5 3
6 6 4
6 2 7
3 1 3
4 1 5
6 2 6
Sample Output 3
Copy
2
6 2 7
4 1 5
6 2 6
Comments