#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[3];
  vector<pair<pair<int, int>, pair<int, int> > > v(100000);
  int ans = 0;
  int i3;
  int k = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if (ans < a[0]) {
      ans = a[0];
      k = 1;
      i3 = i + 1;
    }
    v[i].first.first = a[1];
    v[i].first.second = a[2];
    v[i].second.first = a[0];
    v[i].second.second = i + 1;
  }
  int i1, i2;
  sort(v.begin(), v.begin() + n);
  for (int i = 0; i < n - 1; i++) {
    if (v[i].first == v[i + 1].first) {
      if (ans < min(v[i].first.first,
                    min(v[i].first.second,
                        (v[i].second.first + v[i + 1].second.first)))) {
        ans = min(v[i].first.first,
                  min(v[i].first.second,
                      (v[i].second.first + v[i + 1].second.first)));
        k = 2;
        i1 = v[i].second.second;
        i2 = v[i + 1].second.second;
      }
    }
  }
  if (k == 2) {
    cout << k << endl;
    cout << i1 << " " << i2;
  } else {
    cout << k << endl;
    cout << i3;
  }
  return 0;
}
