#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, pair<int, int> > tab;
template <class T>
inline T min(T x, T y, T z) {
  return min(x, min(y, z));
}
int main() {
  int n;
  scanf("%d", &n);
  int ans = 0, p1, p2;
  int d = 0;
  for (int i = 1; i <= n; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    vector<int> v{x, y, z};
    sort((v).begin(), (v).end());
    do {
      int tmp = min(v[0], v[1], v[2]);
      if (tmp > d) {
        ans = 1;
        p1 = i;
        d = tmp;
      }
      auto pp = tab[{v[0], v[1]}];
      tmp = min(v[0], v[1], v[2] + pp.first);
      if (tmp > d) {
        ans = 2;
        p1 = i;
        p2 = pp.second;
        d = tmp;
      }
      tab[{v[0], v[1]}] = max(pp, {v[2], i});
    } while (next_permutation((v).begin(), (v).end()));
  }
  cout << ans << "\n" << p1;
  if (ans == 2) cout << " " << p2;
  return 0;
}
