#include <bits/stdc++.h>
using namespace std;
int ot, n, k, x, y;
map<pair<int, int>, pair<int, int> > m;
int main() {
  cin >> n;
  int a, b, c;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c;
    if (a > b) swap(a, b);
    if (b > c) swap(b, c);
    if (a > b) swap(a, b);
    if (a > ot) {
      ot = a;
      k = 1;
      x = i;
    }
    if (m.find({b, c}) != m.end() && min(m[{b, c}].first + a, min(b, c)) > ot) {
      ot = min(m[{b, c}].first + a, min(b, c));
      k = 2;
      x = m[{b, c}].second;
      y = i;
    }
    m[{b, c}] = max(m[{b, c}], {a, i});
  }
  cout << k << endl;
  if (k == 1)
    cout << x + 1;
  else
    cout << x + 1 << " " << y + 1 << endl;
}
