#include <iostream>
#include <algorithm>
#include <cstring>
#define int long long
using namespace std;
#define a f[cnt].r1
#define b f[cnt].r2
#define c f[cnt].r3
const int N = 5e5 + 5;
int n;
int ans, maxn, cnt, ans2;
pair<int, int> opt;
struct node{
int r1, r2, r3, w;
}f[N];
inline int c3(int x){
return x * x * x;
}
bool cmp(node a1, node b1){
if(a1.r1 < b1.r1) return false;
else{
if(a1.r1 > b1.r1) return true;
else{
if(a1.r2 < b1.r2) return false;
else{
if(a1.r2 > b1.r2) return true;
else{
if(a1.r3 < b1.r3) return false;
else{
if(a1.r3 > b1.r3) return true;
else return false;
}
}
}
}
}
}
signed main(){
int q, p, o;
cin >> n;
for(int i = 1; i <= n; i ++){
int x, y, z;
cin >> x >> y >> z;
f[++ cnt].w = i;
a = x, b = y, c = z;
maxn = (1.0 * c3(min(min(x, y), z))) / 4;
if(ans < maxn){
ans = maxn;
opt.first = i;
ans2 = 0;
}
f[++ cnt].w = i;
a = x, b = z, c = y;
f[++ cnt].w = i;
a = y, b = x, c = z;
f[++ cnt].w = i;
a = y, b = z, c = x;
f[++ cnt].w = i;
a = z, b = x, c = y;
f[++ cnt].w = i;
a = z, b = y, c = x;
}
sort(f + 1, f + cnt + 1, cmp);
for(int i = 2; i <= cnt; i ++){
if(f[i].r1 == f[i - 1].r1 && f[i].r2 == f[i - 1].r2 && f[i - 1].w != f[i].w){
maxn = (1.0 * c3(min(min(f[i].r3 + f[i - 1].r3, f[i].r1), f[i].r2))) / 4;
if(maxn > ans){
opt = {min(f[i].w, f[i - 1].w), max(f[i].w, f[i - 1].w)};
ans = maxn;
ans2 = 1;
}
}
}
cout << ans2 << endl;
if(ans2 == 0){
cout << opt.first << endl;
}
else{
cout << opt.first << " " << opt.second << endl;
}
cout << ans << endl;
return 0;
}