#include <bits/stdc++.h>
using namespace std;
struct p {
  long long a, b, c;
  int cod;
};
bool cmp(p x, p y) {
  if (x.c != y.c) {
    return x.c < y.c;
  }
  if (x.b != y.b) {
    return x.b < y.b;
  }
  return x.a < y.a;
}
p ps[100050];
int main() {
  ios::sync_with_stdio(false);
  int n;
  long long ans = 0;
  int ans1 = 0, ans2 = 0;
  long long s[3];
  while (cin >> n) {
    for (int i = 1; i <= n; i++) {
      cin >> s[0] >> s[1] >> s[2];
      sort(s, s + 3);
      ps[i].a = s[0], ps[i].b = s[1], ps[i].c = s[2];
      ps[i].cod = i;
      if (s[0] > ans) {
        ans = s[0];
        ans1 = i;
      }
    }
    sort(ps + 1, ps + n + 1, cmp);
    for (int i = n; i > 1; i--) {
      if (ps[i].c == ps[i - 1].c && ps[i].b == ps[i - 1].b) {
        long long t = ps[i].a + ps[i - 1].a;
        long long tt = min(t, ps[i].b);
        if (tt > ans) {
          ans = tt;
          ans1 = ps[i].cod;
          ans2 = ps[i - 1].cod;
        }
      }
    }
    if (ans2 == 0) {
      cout << 1 << endl;
      cout << ans1 << endl;
    } else {
      cout << 2 << endl;
      cout << min(ans1, ans2) << " " << max(ans1, ans2) << endl;
    }
  }
}
