#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  int x, y, z, id;
  bool operator<(const node& b) const {
    if (x != b.x) return x < b.x;
    if (y != b.y) return y < b.y;
    return z < b.z;
  }
} a[100005];
int main() {
  while (~scanf("%d", &n)) {
    int num = 1, ans = -1, ans1, ans2;
    for (int i = 1; i <= n; i++) {
      int x[4];
      for (int j = 0; j < 3; j++) scanf("%d", &x[j]);
      sort(x, x + 3);
      a[i].x = x[2], a[i].y = x[1], a[i].z = x[0], a[i].id = i;
      if (x[0] > ans) ans = x[0], ans1 = i;
    }
    sort(a + 1, a + n + 1);
    for (int i = 1; i < n; i++)
      if (a[i].x == a[i + 1].x && a[i].y == a[i + 1].y) {
        int x = a[i].x, y = a[i].y, z = a[i].z + a[i + 1].z;
        int temp = min(x, min(y, z));
        if (temp > ans) num = 2, ans = temp, ans1 = a[i].id, ans2 = a[i + 1].id;
      }
    printf("%d\n", num);
    if (num == 1)
      printf("%d\n", ans1);
    else
      printf("%d %d\n", ans1, ans2);
  }
  return 0;
}
