#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<vector<int> > a(n, vector<int>(3));
  map<pair<int, int>, vector<pair<int, int> > > m;
  int res = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) scanf("%d", &a[i][j]);
    sort(a[i].begin(), a[i].end());
    m[make_pair(a[i][0], a[i][1])].push_back(make_pair(a[i][2], i + 1));
    m[make_pair(a[i][0], a[i][2])].push_back(make_pair(a[i][1], i + 1));
    m[make_pair(a[i][1], a[i][2])].push_back(make_pair(a[i][0], i + 1));
  }
  pair<int, int> ind;
  for (map<pair<int, int>, vector<pair<int, int> > >::iterator it = m.begin();
       it != m.end(); it++) {
    int tres = it->first.first;
    sort(it->second.rbegin(), it->second.rend());
    it->second.erase(unique(it->second.begin(), it->second.end()),
                     it->second.end());
    int tmp = it->second[0].first;
    if (it->second.size() > 1) tmp += it->second[1].first;
    tres = min(tres, tmp);
    if (tres > res) {
      res = tres;
      ind = make_pair(it->second[0].second,
                      it->second.size() > 1 ? it->second[1].second : -1);
    }
  }
  printf("%d\n", ind.second == -1 ? 1 : 2);
  printf("%d ", ind.first);
  if (ind.second != -1) printf("%d", ind.second);
  printf("\n");
  return 0;
}
