#include <bits/stdc++.h>
const int N = 100010;
int n, c, ans1, ans2, now, Max;
char s[N];
struct lr {
  int t[3], pos;
  bool operator<(const lr &a) const {
    if (t[1] > a.t[1]) return 1;
    if (t[1] < a.t[1]) return 0;
    if (t[2] > a.t[2]) return 1;
    if (t[2] < a.t[2]) return 0;
    return t[0] > a.t[0];
  }
} a[N];
inline int min(int a, int b) { return a < b ? a : b; }
inline int max(int a, int b) { return a > b ? a : b; }
inline int abs(int a) { return a < 0 ? -a : a; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d%d", &a[i].t[0], &a[i].t[1], &a[i].t[2]);
    a[i].pos = i;
    std::sort(a[i].t, a[i].t + 3);
  }
  std::sort(a + 1, a + 1 + n);
  a[n + 1].t[1] = -1;
  for (int i = 1; i <= n; ++i) {
    if (a[i].t[1] == a[i + 1].t[1] && a[i].t[2] == a[i + 1].t[2]) {
      int r = min(a[i].t[0] + a[i + 1].t[0], a[i].t[1]);
      if (r > Max) Max = r, ans1 = a[i].pos, ans2 = a[i + 1].pos;
    }
    if (a[i].t[0] > Max) Max = a[i].t[0], ans1 = a[i].pos, ans2 = 0;
  }
  if (ans2) {
    puts("2");
    printf("%d %d\n", ans1, ans2);
  } else
    printf("1\n%d\n", ans1);
  return 0;
}
