#include <bits/stdc++.h>
using namespace std;
map<long long, int> mp, ind;
long long code;
int a, b, c, n, res, ans, ind1, ind2, i;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d%d%d", &a, &b, &c);
    if (a > b) swap(a, b);
    if (a > c) swap(a, c);
    if (b > c) swap(b, c);
    if (ans < a) ans = a, ind1 = i, ind2 = 0;
    code = (b * 1LL << 31) + c;
    res = min(b, mp[code] + a);
    if (ans < res) {
      ans = res;
      ind1 = i;
      ind2 = ind[code];
    }
    if (mp[code] < a) {
      mp[code] = a;
      ind[code] = i;
    }
  }
  printf("%d\n%d", (ind2 > 0) + 1, ind1);
  if (ind2) printf(" %d", ind2);
  return 0;
}
