#include <bits/stdc++.h>
using namespace std;
int n, ans1, ans2, id, id1, id2;
int v[100010][3];
struct node {
  int x, y, z, d;
  bool operator<(const node &t) const {
    if (x == t.x) {
      if (y == t.y)
        return z < t.z;
      else
        return y < t.y;
    } else
      return x < t.x;
  }
} p[100010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &v[i][0], &v[i][1], &v[i][2]);
    sort(v[i], v[i] + 3);
    if (ans1 < v[i][0]) id = i, ans1 = v[i][0];
    p[i].x = v[i][2], p[i].y = v[i][1], p[i].z = v[i][0], p[i].d = i;
  }
  sort(p + 1, p + n + 1);
  for (int i = 1, j; i <= n; i = j + 1) {
    j = i + 1;
    while (j <= n && p[j].x == p[i].x && p[j].y == p[i].y) j++;
    j--;
    if (i != j) {
      int tmp = min(p[j - 1].z + p[j].z, p[j].x);
      tmp = min(tmp, p[i].y);
      if (tmp > ans2) ans2 = tmp, id1 = p[j].d, id2 = p[j - 1].d;
    }
  }
  if (ans1 >= ans2)
    printf("1\n%d\n", id);
  else
    printf("2\n%d %d\n", id1, id2);
  return 0;
}
