#include <bits/stdc++.h>
using namespace std;
int radius(int a, int b, int c) {
  int min1 = 1E9;
  if (a < min1) min1 = a;
  if (b < min1) min1 = b;
  if (c < min1) min1 = c;
  return min1;
}
int radius(vector<int> a) { return *min_element(a.begin(), a.end()); }
bool cmp(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  int n;
  cin >> n;
  map<pair<int, int>, vector<pair<int, int> > > m;
  vector<vector<int> > a(n, vector<int>(3));
  pair<pair<int, int>, int> ans =
      pair<pair<int, int>, int>(pair<int, int>(-1, -1), -1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
    if (radius(a[i]) > ans.second) {
      ans = pair<pair<int, int>, int>(pair<int, int>(i + 1, -1), radius(a[i]));
    }
    sort(a[i].begin(), a[i].end());
    set<pair<pair<int, int>, int> > s;
    s.insert(
        pair<pair<int, int>, int>(pair<int, int>(a[i][0], a[i][1]), a[i][2]));
    s.insert(
        pair<pair<int, int>, int>(pair<int, int>(a[i][1], a[i][2]), a[i][0]));
    s.insert(
        pair<pair<int, int>, int>(pair<int, int>(a[i][0], a[i][2]), a[i][1]));
    for (set<pair<pair<int, int>, int> >::iterator it = s.begin();
         it != s.end(); it++) {
      m[it->first].push_back(pair<int, int>(it->second, i + 1));
    }
  }
  for (map<pair<int, int>, vector<pair<int, int> > >::iterator it = m.begin();
       it != m.end(); it++) {
    if (it->second.size() >= 2) {
      sort(it->second.begin(), it->second.end());
      int sz = it->second.size();
      int c1 = it->second[sz - 1].first;
      int i1 = it->second[sz - 1].second;
      int c2 = it->second[sz - 2].first;
      int i2 = it->second[sz - 2].second;
      int r = radius(it->first.first, it->first.second, c1 + c2);
      if (r > ans.second) {
        ans = pair<pair<int, int>, int>(pair<int, int>(i1, i2), r);
      }
    }
  }
  int k = 0;
  int ans1 = ans.first.first;
  int ans2 = ans.first.second;
  if (ans1 != -1) k++;
  if (ans2 != -1) k++;
  cout << k << endl;
  if (ans1 != -1) cout << ans1 << " ";
  if (ans2 != -1) cout << ans2 << endl;
  ;
  return 0;
}
