#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, j, k;
  long double a, b, c, best, x;
  vector<long long> ans;
  map<pair<long double, long double>, map<long long, long double>> pp;
  cin >> n;
  best = 0;
  for (i = 0; i < n; i++) {
    cin >> a >> b >> c;
    x = min(a, min(b, c));
    if (x > best) {
      best = x;
      ans.clear();
      ans.push_back(i + 1);
    }
    pp[{min(a, b), max(a, b)}][i] = max(pp[{min(a, b), max(a, b)}][i], c);
    pp[{min(c, b), max(c, b)}][i] = max(pp[{min(c, b), max(c, b)}][i], a);
    pp[{min(c, a), max(c, a)}][i] = max(pp[{min(c, a), max(c, a)}][i], b);
  }
  for (auto p : pp) {
    if (p.second.size() >= 2) {
      vector<pair<long double, long long>> plist;
      for (auto v : p.second) {
        plist.push_back({v.second, v.first});
      }
      sort(plist.rbegin(), plist.rend());
      x = min(min(p.first.first, p.first.second),
              (plist[0].first + plist[1].first));
      if (x > best) {
        best = x;
        ans.clear();
        ans.push_back(plist[0].second + 1);
        ans.push_back(plist[1].second + 1);
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto p : ans) cout << p << " ";
  cout << "\n";
  return 0;
}
