#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 2000;
struct yuu {
  long long a[3];
  int m;
} v[N];
int cmp(yuu a, yuu b) {
  if (a.a[0] == b.a[0])
    if (a.a[1] == b.a[1])
      return a.a[2] > b.a[2];
    else
      return a.a[1] > b.a[1];
  return a.a[0] > b.a[0];
}
int cmp2(long long a, long long b) { return a > b; }
int main() {
  int n;
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      scanf("%lld%lld%lld", &v[i].a[0], &v[i].a[1], &v[i].a[2]);
      sort(v[i].a, v[i].a + 3, cmp2);
      v[i].m = i;
    }
    sort(v, v + n, cmp);
    int l, r;
    l = r = v[0].m;
    long long ma = v[0].a[2];
    for (int i = 1; i < n; i++) {
      if (v[i].a[0] == v[i - 1].a[0] && v[i].a[1] == v[i - 1].a[1]) {
        long long t = v[i].a[2] + v[i - 1].a[2];
        t = min(t, min(v[i].a[0], v[i].a[1]));
        if (t > ma) {
          ma = t;
          l = v[i - 1].m;
          r = v[i].m;
        }
      } else {
        if (ma < v[i].a[2]) {
          ma = v[i].a[2];
          l = r = v[i].m;
        }
      }
    }
    if (l > r)
      printf("2\n%d %d\n", r + 1, l + 1);
    else if (l == r)
      printf("1\n%d\n", l + 1);
    else
      printf("2\n%d %d\n", l + 1, r + 1);
  }
  return 0;
}
