#include <bits/stdc++.h>
using namespace std;
struct cuboid {
  int d[3];
  int index;
};
cuboid c[100001];
int n, k = 0, ans, t1, t2;
bool compare(cuboid x, cuboid y) {
  return x.d[1] < y.d[1] || x.d[1] == y.d[1] && x.d[2] < y.d[2] ||
         x.d[1] == y.d[1] && x.d[2] == y.d[2] && x.d[0] < y.d[0];
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) scanf("%d", &c[i].d[j]);
    sort(c[i].d, c[i].d + 3);
    c[i].index = i + 1;
  }
  sort(c, c + n, compare);
  for (int i = 0; i < n; i++) {
    if (i != n - 1 && c[i].d[1] == c[i + 1].d[1] &&
        c[i].d[2] == c[i + 1].d[2]) {
      if (k < min(c[i].d[0] + c[i + 1].d[0], c[i].d[1])) {
        k = min(c[i].d[0] + c[i + 1].d[0], c[i].d[1]);
        ans = 2;
        t1 = c[i].index;
        t2 = c[i + 1].index;
      }
    } else if (k < c[i].d[0]) {
      k = c[i].d[0];
      ans = 1;
      t1 = c[i].index;
    }
  }
  printf("%d\n", ans);
  printf("%d", t1);
  if (ans == 2) printf(" %d", t2);
  printf("\n");
  return 0;
}
