#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x, y, z;
  while (cin >> n) {
    map<pair<int, int>, set<pair<int, int> > > box;
    int ans = 1, i1, i2, mxa = 0, x, y, z;
    vector<int> t(3);
    for (int i = 0; i < n; i++) {
      cin >> t[0] >> t[1] >> t[2];
      sort(t.begin(), t.end());
      x = t[0];
      y = t[1];
      z = t[2];
      box[make_pair(x, y)].insert(make_pair(z, i + 1));
      box[make_pair(x, z)].insert(make_pair(y, i + 1));
      box[make_pair(y, z)].insert(make_pair(x, i + 1));
      if (x > mxa) {
        mxa = x;
        i1 = i + 1;
      }
    }
    for (map<pair<int, int>, set<pair<int, int> > >::iterator it = box.begin();
         it != box.end(); it++) {
      if (it->second.size() > 1) {
        set<pair<int, int> >::iterator it1 = it->second.begin(), it2;
        it2 = it1;
        it2++;
        int top = min(it->first.first, it->first.second);
        while (it2 != it->second.end()) {
          int sum = it2->first + it1->first;
          int mmin = min(top, sum);
          if (mmin > mxa) {
            mxa = mmin;
            i1 = it2->second;
            i2 = it1->second;
            ans = 2;
          }
          it1++;
          it2++;
          if (sum > top) {
            break;
          }
        }
      }
    }
    if (ans == 2) {
      cout << ans << endl << i1 << " " << i2 << endl;
    } else {
      cout << ans << endl << i1 << endl;
    }
  }
}
