#include <bits/stdc++.h>
using namespace std;
struct com {
  bool operator()(tuple<int, int, int> T1, tuple<int, int, int> T2) {
    if (get<0>(T1) != get<1>(T2))
      return get<0>(T1) > get<0>(T2);
    else if (get<1>(T1) != get<1>(T2))
      return get<1>(T1) > get<1>(T2);
    else
      return get<2>(T1) > get<2>(T2);
  }
};
int main() {
  int n, m, M;
  int u, v, w;
  int k, idx;
  cin >> n;
  vector<tuple<int, int, int, int> > in(n);
  for (int i = 0; i < n; i++) {
    cin >> u >> v >> w;
    m = min(u, min(v, w));
    M = max(u, max(v, w));
    in[i] = make_tuple(M, u + v + w - m - M, m, i);
  }
  sort((in).begin(), (in).end(), greater<tuple<int, int, int, int> >());
  cerr << endl;
  for (int i = 0; i < n; i++) {
    cerr << get<0>(in[i]) << ' ';
    cerr << get<1>(in[i]) << ' ';
    cerr << get<2>(in[i]) << ' ';
    cerr << endl;
  }
  cerr << endl;
  M = INT_MIN;
  k = 1;
  for (int i = 0; i < n; i++)
    if (get<2>(in[i]) > M) {
      M = get<2>(in[i]);
      idx = i;
    }
  for (int i = 1; i < n; i++) {
    if (get<0>(in[i]) == get<0>(in[i - 1]) and
        get<1>(in[i]) == get<1>(in[i - 1])) {
      u = get<0>(in[i]);
      v = get<1>(in[i]);
      w = get<2>(in[i]) + get<2>(in[i - 1]);
      m = min(u, min(v, w));
    }
    if (m > M) {
      k = 2;
      M = m;
      idx = i;
    }
  }
  if (k == 1) {
    cout << k << endl;
    cout << get<3>(in[idx]) + 1 << endl;
  } else if (k == 2) {
    cout << k << endl;
    cout << get<3>(in[idx]) + 1 << ' ' << get<3>(in[idx - 1]) + 1 << endl;
  }
  return 0;
}
