There are three machines on the new toy factory: A, B and C. The factory makes
toys by processing each toy on these machines in order A, B, C. Your task
is to create N toys as soon as possible. You know the time to process
each toy on each machine: a_{i}, b_{i} and c_{i}. You can select
an arbitrary order of processing toys. The second machine is so fast that at least one of the following two statements
holds: max(b_{i}) ≤ min(a_{i}) or max(b_{i}) ≤ min(c_{i}).
Input
The first line of the input contains the number of toys N (1 ≤ N ≤ 10^{5}). The next
N lines contain three integers each: a_{i}, b_{i} and c_{i}
(1 ≤ a_{i}, b_{i}, c_{i} ≤ 10^{6}).
Output
Output the minimal possible processing time on the first line.
The second line must contain an example of optimal processing order —
a permutation of toy numbers from 1 to N.
Samples
input  output 

5
3 1 6
1 1 2
5 2 5
7 1 4
10 2 8
 33
2 1 3 5 4

1
5 4 7
 16
1

Problem Author: Dmitry Gozman
Problem Source: Dmitry Gozman Contest 1, Petrozavodsk training camp, January 2007