#include <bits/stdc++.h>
using namespace std;
long long n, l, x, y, mix, i;
map<pair<long long, long long>, long long> mp[2];
void help(long long a, long long b, long long c) {
  l = mp[0][{a, b}];
  mp[0][{a, b}] = max(c, mp[0][{a, b}]);
  if (l != mp[0][{a, b}]) mp[1][{a, b}] = i;
}
long long a, b, c;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a >> b >> c;
    l = mix;
    mix = max(mix, min(a, min(b, c)));
    if (mix != l) {
      x = i;
      y = -1;
    }
    l = mix;
    mix = max(mix, min((mp[0][{a, b}] + c), min(a, b)));
    if (l != mix) {
      x = i;
      y = mp[1][{a, b}];
    }
    l = mix;
    mix = max(mix, min((mp[0][{a, c}] + b), min(a, c)));
    if (l != mix) {
      x = i;
      y = mp[1][{a, c}];
    }
    l = mix;
    mix = max(mix, min((mp[0][{c, b}] + a), min(c, b)));
    if (l != mix) {
      x = i;
      y = mp[1][{c, b}];
    }
    help(a, b, c);
    help(a, c, b);
    help(c, a, b);
    help(b, a, c);
    help(c, b, a);
    help(b, c, a);
  }
  if (y == -1) {
    cout << 1 << endl;
    cout << x << endl;
  } else {
    cout << 2 << endl;
    cout << x << " " << y << endl;
  }
}
