#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
const long long mod = 1000000000;
long long ans;
long long n, a[N], b[N], c[N];
long long modify(long long a, long long b, long long c) {
  return min(min(a, b), c);
}
map<pair<long long, long long>, long long> pos, vl;
long long pos1, pos2;
signed main() {
  scanf("%d", &n);
  for (long long i = 1; i <= n; ++i) {
    scanf("%I64d%I64d%I64d", &a[i], &b[i], &c[i]);
    if (a[i] > b[i]) swap(a[i], b[i]);
    if (a[i] > c[i]) swap(c[i], a[i]);
    if (b[i] > c[i]) swap(b[i], c[i]);
    if (ans < modify(a[i], b[i], c[i])) {
      pos1 = i;
      ans = modify(a[i], b[i], c[i]);
    }
  }
  for (long long i = 1; i <= n; ++i) {
    pair<long long, long long> cnt = pair<long long, long long>(a[i], b[i]);
    if (vl.count(cnt))
      if (ans < modify(a[i], b[i], c[i] + vl[cnt])) {
        ans = modify(a[i], b[i], c[i] + vl[cnt]);
        pos1 = pos[cnt];
        pos2 = i;
      }
    cnt = pair<long long, long long>(a[i], c[i]);
    if (vl.count(cnt))
      if (ans < modify(a[i], c[i], b[i] + vl[cnt])) {
        ans = modify(a[i], c[i], b[i] + vl[cnt]);
        pos1 = pos[cnt];
        pos2 = i;
      }
    cnt = pair<long long, long long>(b[i], c[i]);
    if (vl.count(cnt))
      if (ans < modify(c[i], b[i], a[i] + vl[cnt])) {
        ans = modify(c[i], b[i], a[i] + vl[cnt]);
        pos1 = pos[cnt];
        pos2 = i;
      }
    cnt = pair<long long, long long>(a[i], b[i]);
    if (pos.count(cnt) == 0 || vl[cnt] < c[i]) {
      pos[cnt] = i;
      vl[cnt] = c[i];
    }
    cnt = pair<long long, long long>(b[i], c[i]);
    if (pos.count(cnt) == 0 || vl[cnt] < a[i]) {
      pos[cnt] = i;
      vl[cnt] = a[i];
    }
    cnt = pair<long long, long long>(a[i], c[i]);
    if (pos.count(cnt) == 0 || vl[cnt] < b[i]) {
      pos[cnt] = i;
      vl[cnt] = b[i];
    }
  }
  if (pos2 == 0) {
    printf("1\n");
    printf("%I64d", pos1);
  } else {
    printf("2\n");
    printf("%I64d %I64d", pos1, pos2);
  }
  return 0;
}
