#include <bits/stdc++.h>
using namespace std;
ifstream fin("input.txt");
ofstream fout("output.txt");
long long a[3];
int main() {
  map<pair<long long, long long>, long long> mp, p;
  int n;
  cin >> n;
  long long maxx = 0LL;
  int num = 0, ind = 0, ind1 = 0, ind2 = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if (maxx < a[0]) {
      num = 1;
      maxx = a[0];
      ind = i;
    }
    if (min(a[1], mp[make_pair(a[1], a[2])] + a[0]) > maxx) {
      num = 2;
      maxx = min(a[1], mp[make_pair(a[1], a[2])] + a[0]);
      ind1 = p[make_pair(a[1], a[2])];
      ind2 = i;
    }
    if (mp[make_pair(a[1], a[2])] < a[0]) {
      mp[make_pair(a[1], a[2])] = a[0];
      p[make_pair(a[1], a[2])] = i;
    }
  }
  if (num == 2)
    cout << "2\n" << ind1 << " " << ind2 << "\n";
  else
    cout << "1\n" << ind << "\n";
  return 0;
}
