#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, set<pair<int, int> > > M;
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int a[3];
    for (int j = 0; j < 3; ++j) scanf("%d", &a[j]);
    sort(a, a + 3);
    M[make_pair(a[0], a[1])].insert(make_pair(a[2], i + 1));
    M[make_pair(a[1], a[2])].insert(make_pair(a[0], i + 1));
    M[make_pair(a[0], a[2])].insert(make_pair(a[1], i + 1));
  }
  int ressz = 0;
  int res[2];
  int lmax = 0;
  for (map<pair<int, int>, set<pair<int, int> > >::iterator it = M.begin();
       it != M.end(); ++it) {
    while (it->second.size() > 2) it->second.erase(it->second.begin());
    int l = 0, sz = 0;
    int curres[2];
    for (set<pair<int, int> >::iterator jt = it->second.begin();
         jt != it->second.end(); ++jt) {
      l += jt->first;
      curres[sz++] = jt->second;
    }
    if (min(l, it->first.first) > lmax) {
      lmax = min(l, it->first.first);
      ressz = sz;
      for (int i = 0; i < sz; ++i) res[i] = curres[i];
    }
  }
  printf("%d\n", ressz);
  for (int i = 0; i < ressz; ++i) printf("%d ", res[i]);
  printf("\n");
  return 0;
}
