#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 50;
int n;
struct st {
  int a[3];
  int id;
} a[MAXN];
int cmp(st a, st b) {
  if (a.a[0] != b.a[0]) return a.a[0] > b.a[0];
  if (a.a[1] != b.a[1]) return a.a[1] > b.a[1];
  return a.a[2] > b.a[2];
}
int comp(int a, int b) { return a > b; }
int main() {
  int flag = 0, q = -1, maxn = -1, temp;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d %d", &a[i].a[0], &a[i].a[1], &a[i].a[2]);
    sort(a[i].a, a[i].a + 3, comp);
    if (a[i].a[2] >= a[flag].a[2]) {
      flag = i;
      maxn = a[i].a[2];
    }
    a[i].id = i + 1;
  }
  sort(a, a + n, cmp);
  for (int i = 1; i < n; ++i) {
    if (a[i].a[0] == a[i - 1].a[0] && a[i].a[1] == a[i - 1].a[1]) {
      temp = min(a[i].a[1], a[i].a[2] + a[i - 1].a[2]);
      if (temp > maxn) {
        q = i;
        maxn = temp;
      }
    }
  }
  if (q == -1)
    printf("1\n%d\n", flag + 1);
  else
    printf("2\n%d %d\n", min(a[q].id, a[q - 1].id), max(a[q].id, a[q - 1].id));
  return 0;
}
