#include <bits/stdc++.h>
using namespace std;
unsigned long long n;
const unsigned long long mod = 1000000000;
unsigned long long x, y, z;
map<unsigned long long, unsigned long long> m;
int main(void) {
  scanf("%lld", &n);
  unsigned long long mini = 0;
  unsigned long long k = 1;
  unsigned long long num = 0, numm = 0;
  for (unsigned long long i = 0; i < n; i++) {
    scanf("%lld%lld%lld", &x, &y, &z);
    if (x < y) swap(x, y);
    if (x < z) swap(x, z);
    if (y < z) swap(y, z);
    if (mini < z) mini = z, k = 1, num = i + 1;
    unsigned long long d = m[x * mod + y];
    unsigned long long e = d / mod;
    d = d % mod;
    if (d) {
      unsigned long long mi = min(x, y);
      mi = min(mi, z + d);
      if (mi > mini) {
        k = 2;
        num = e;
        numm = i + 1;
        mini = mi;
      }
    }
    if (d < z) {
      d = (i + 1) * mod + z;
    } else {
      d = e * mod + d;
    }
    m[x * mod + y] = d;
  }
  if (k == 1) {
    printf("1\n%lld", num);
  } else {
    printf("2\n");
    printf("%lld %lld", num, numm);
  }
}
