#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int INF = (1 << 30) - 1;
const int MAXN = 200010;
int n;
map<pair<int, int>, pair<int, int> > mp;
int A[1000010][3];
int ans[1000010][2];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int a[3];
    scanf("%d%d%d", &a[0], &a[1], &a[2]);
    sort(a, a + 3);
    A[i][0] = a[0];
    A[i][1] = a[1];
    A[i][2] = a[2];
    if (mp[make_pair(a[1], a[2])].first &&
        min(a[1], a[0] + mp[make_pair(a[1], a[2])].first) > ans[i][0]) {
      ans[i][0] = min(a[1], a[0] + mp[make_pair(a[1], a[2])].first);
      ans[i][1] = mp[make_pair(a[1], a[2])].second;
    }
    mp[make_pair(a[1], a[2])] =
        max(mp[make_pair(a[1], a[2])], make_pair(a[0], i));
    if (a[0] > ans[i][0]) {
      ans[i][0] = a[0];
      ans[i][1] = i;
    }
  }
  mp.clear();
  for (int i = n; i >= 1; --i) {
    int a[3] = {A[i][0], A[i][1], A[i][2]};
    if (min(a[1], a[0] + mp[make_pair(a[1], a[2])].first) > ans[i][0]) {
      ans[i][0] = min(a[1], a[0] + mp[make_pair(a[1], a[2])].first);
      ans[i][1] = mp[make_pair(a[1], a[2])].second;
    }
    mp[make_pair(a[1], a[2])] =
        max(mp[make_pair(a[1], a[2])], make_pair(a[0], i));
  }
  int tmaxi = 1;
  for (int i = 2; i <= n; ++i) {
    if (ans[i][0] > ans[tmaxi][0]) {
      tmaxi = i;
    }
  }
  if (ans[tmaxi][1] == tmaxi) {
    printf("1\n");
    printf("%d\n", tmaxi);
  } else {
    printf("2\n");
    printf("%d %d\n", tmaxi, ans[tmaxi][1]);
  }
  return 0;
}
