#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double E = 2.718281828459;
const int INF = 2e9;
const long long LINF = 1e18 + 5;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int MN = 1e6 + 2;
vector<long long> v[MAXN];
map<pair<long long, long long>, vector<long long> > mapa;
map<pair<long long, long long>, vector<long long> >::iterator it;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    v[i].resize(3);
    for (int j = 0; j < 3; ++j) cin >> v[i][j];
    sort((v[i]).begin(), (v[i]).end());
    mapa[make_pair(v[i][2], v[i][1])].push_back(v[i][0]);
  }
  long long maxi1 = 0;
  int idx1 = -1;
  for (int i = 0; i < n; ++i) {
    if (v[i][0] > maxi1) {
      idx1 = i;
      maxi1 = v[i][0];
    }
  }
  long long r1, r2;
  long long s1, s2;
  long long maxi2 = 0;
  for (it = mapa.begin(); it != mapa.end(); ++it) {
    if ((it->second).size() == 1) continue;
    sort((it->second).begin(), (it->second).end());
    long long u = (it->first).first;
    long long v = (it->first).second;
    int len = (it->second).size();
    long long s = (it->second)[len - 1] + (it->second)[len - 2];
    long long tt = min(u, v);
    tt = min(tt, s);
    if (tt > maxi2) {
      maxi2 = tt;
      r1 = u;
      r2 = v;
      s1 = (it->second)[len - 1];
      s2 = (it->second)[len - 2];
    }
  }
  if (maxi1 >= maxi2) {
    cout << 1 << endl;
    cout << idx1 + 1 << endl;
  } else {
    cout << 2 << endl;
    int id1 = -1, id2 = -1;
    for (int i = 0; i < n; ++i) {
      if (v[i][2] == r1 && v[i][1] == r2 && v[i][0] == s1) {
        if (id1 == -1) id1 = i;
      }
    }
    for (int i = 0; i < n; ++i) {
      if (i == id1) continue;
      if (v[i][2] == r1 && v[i][1] == r2 && v[i][0] == s2) {
        if (id2 == -1) id2 = i;
      }
    }
    cout << id1 + 1 << " " << id2 + 1 << endl;
  }
  return 0;
}
