#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k = 1;
  int r = 0;
  int index1, index2;
  cin >> n;
  vector<pair<pair<int, int>, pair<int, int>>> s(n);
  vector<int> t(3);
  for (int i = 0; i < n; i++) {
    scanf("%i%i%i", &t[0], &t[1], &t[2]);
    sort(t.begin(), t.end());
    s[i].first.first = t[2];
    s[i].first.second = t[1];
    s[i].second.first = t[0];
    s[i].second.second = i;
    if (t[0] > r) {
      index1 = i;
      r = t[0];
    }
  }
  sort(s.begin(), s.end());
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i].first.first == s[i + 1].first.first &&
        s[i].first.second == s[i + 1].first.second) {
      int temp = min(s[i].second.first + s[i + 1].second.first,
                     min(s[i].first.first, s[i].first.second));
      if (temp > r) {
        r = temp;
        index1 = s[i].second.second;
        index2 = s[i + 1].second.second;
        k = 2;
      }
    }
  }
  cout << k << endl;
  if (k == 1) {
    cout << index1 + 1 << endl;
  } else
    cout << index1 + 1 << " " << index2 + 1 << endl;
  return 0;
}
