#include <bits/stdc++.h>
using namespace std;
vector<pair<vector<long long>, int> > v;
vector<long long> x, y;
bool SRT(pair<vector<long long>, int> a, pair<vector<long long>, int> b) {
  if (a.first[0] == b.first[0]) {
    if (a.first[1] == b.first[1]) {
      return a.first[2] > b.first[2];
    }
    return a.first[1] > b.first[1];
  }
  return a.first[0] > b.first[0];
}
bool AC(long long a, long long b) { return a > b; }
int main() {
  int n;
  long long a, b, c, mxRad = 0, ansa = -1, ansb = -1;
  scanf("%d", &n);
  for (__typeof(n) i = 0; i < (n); ++i) {
    scanf("%I64d %I64d %I64d", &a, &b, &c);
    x.clear();
    x.push_back(a);
    x.push_back(b);
    x.push_back(c);
    long long mn = min(a, min(b, c));
    if (mn > mxRad) {
      mxRad = mn;
      ansa = i + 1;
    }
    sort(x.begin(), x.end(), AC);
    v.push_back(make_pair(x, i + 1));
  }
  sort(v.begin(), v.end(), SRT);
  for (__typeof(n - 1) i = 0; i < (n - 1); ++i) {
    x = v[i].first;
    int j = i + 1;
    y = v[j].first;
    if (x[0] == y[0] && x[1] == y[1]) {
      long long mn = min(x[0], min(x[1], x[2] + y[2]));
      if (mn > mxRad) {
        mxRad = mn;
        ansa = v[i].second;
        ansb = v[j].second;
      }
    } else if (x[0] == y[0] && x[2] == y[2]) {
      long long mn = min(x[0], min(x[2], x[1] + y[1]));
      if (mn > mxRad) {
        mxRad = mn;
        ansa = v[i].second;
        ansb = v[j].second;
      }
    } else if ((x[1] == y[1] && x[2] == y[2])) {
      long long mn = min(x[1], min(x[2], x[0] + y[0]));
      if (mn > mxRad) {
        mxRad = mn;
        ansa = v[i].second;
        ansb = v[j].second;
      }
    }
  }
  if (ansb == -1) {
    printf("1\n%I64d", ansa);
    return 0;
  }
  printf("2\n%I64d %I64d", ansa, ansb);
  return 0;
}
