#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, a, b, c, ma, mb, mc;
  int maxmin = 0;
  int imaxmin = 0;
  map<pair<int, int>, set<pair<int, int>>> m;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b >> c;
    if (min(a, min(b, c)) > maxmin) {
      maxmin = min(a, min(b, c));
      imaxmin = i + 1;
    }
    auto temp = pair<int, int>(max(a, b), min(a, b));
    m[temp].insert(pair<int, int>(c, i + 1));
    temp = pair<int, int>(max(a, c), min(a, c));
    m[temp].insert(pair<int, int>(b, i + 1));
    temp = pair<int, int>(max(c, b), min(c, b));
    m[temp].insert(pair<int, int>(a, i + 1));
  }
  int i1, i2, mm = 0;
  for (auto &i : m) {
    if (i.second.size() <= 1) continue;
    auto it = i.second.rbegin();
    int kek1 = it->first;
    ++it;
    int kek2 = it->first;
    if (min(kek1 + kek2, min(i.first.first, i.first.second)) > mm) {
      mm = min(kek1 + kek2, min(i.first.first, i.first.second));
      it = i.second.rbegin();
      i1 = it->second;
      ++it;
      i2 = it->second;
    }
  }
  if (mm > maxmin) {
    cout << 2 << endl;
    cout << i1 << " " << i2 << endl;
  } else {
    cout << 1 << endl;
    cout << imaxmin << endl;
  }
  return 0;
}
