#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  vector<pair<pair<int, int>, pair<int, int> > > v;
  int n;
  cin >> n;
  int in[3];
  int i;
  vector<int> answer;
  for (i = 0; i < n; i++) {
    cin >> in[0] >> in[1] >> in[2];
    sort(in, in + 3);
    v.push_back({{in[2], in[1]}, {in[0], i + 1}});
  }
  double ans = 0;
  double x;
  sort(v.begin(), v.end());
  for (i = 0; i < n; i++) {
    x = (double)v[i].second.first / 2;
    ans = max(ans, x);
    if (x == ans) {
      answer.clear();
      answer.push_back(v[i].second.second);
    }
  }
  for (i = 0; i < n - 1; i++) {
    if (v[i].first.first == v[i + 1].first.first &&
        v[i].first.second == v[i + 1].first.second) {
      x = ((double)v[i].second.first + (double)v[i + 1].second.first);
      x = min(x, (double)v[i].first.first);
      x = min(x, (double)v[i].first.second);
      x = x / 2;
      ans = max(ans, x);
      if (x == ans) {
        answer.clear();
        answer.push_back(v[i].second.second);
        answer.push_back(v[i + 1].second.second);
      }
    }
  }
  cout << answer.size() << "\n";
  for (i = 0; i < answer.size(); i++) printf("%d ", answer[i]);
}
