#include <bits/stdc++.h>
using namespace std;
int n, x, y, z, ans = 0, ansa, ansb, i, lans = 0, lansa;
map<pair<int, int>, pair<int, int>> a;
void ins(int x, int y, int z) {
  if (min(x, min(y, z + a[{x, y}].first)) > ans && a[{x, y}].second != 0)
    ans = min(x, min(y, z + a[{x, y}].first)), ansa = a[{x, y}].second,
    ansb = i + 1;
  if (min(x, min(z, y + a[{x, z}].first)) > ans && a[{x, z}].second != 0)
    ans = min(x, min(z, y + a[{x, z}].first)), ansa = a[{x, z}].second,
    ansb = i + 1;
  if (min(y, min(z, x + a[{y, z}].first)) > ans && a[{y, z}].second != 0)
    ans = min(y, min(z, x + a[{y, z}].first)), ansa = a[{y, z}].second,
    ansb = i + 1;
  if (x > a[{y, z}].first) a[{y, z}].first = x, a[{y, z}].second = i + 1;
  if (y > a[{x, z}].first) a[{x, z}].first = y, a[{x, z}].second = i + 1;
  if (z > a[{x, y}].first) a[{x, y}].first = z, a[{x, y}].second = i + 1;
  if (min(x, min(y, z)) > lans) lans = min(x, min(y, z)), lansa = i + 1;
}
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x >> y >> z;
    if (x > y) swap(x, y);
    if (x > z) swap(x, z);
    if (y < z) swap(y, z);
    ins(x, y, z);
  }
  if (ans > lans)
    cout << "2\n" << ansa << " " << ansb;
  else
    cout << "1\n" << lansa;
  return 0;
}
