#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long ans = 0, ans2 = -1, cnt = 1, ac = -1;
  set<long long> se[n];
  map<pair<long long, long long>, vector<pair<long long, long long> > > mp;
  for (long long i = 0; i < n; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    se[i].insert({x, i});
    se[i].insert({y, i});
    se[i].insert({z, i});
    mp[{x, y}].push_back({z, i});
    mp[{x, z}].push_back({y, i});
    mp[{z, y}].push_back({x, i});
    if (x != y) mp[{y, x}].push_back({z, i});
    if (x != z) mp[{z, x}].push_back({y, i});
    if (y != z) mp[{y, z}].push_back({x, i});
    long long mn = min(x, min(y, z));
    if (mn >= ac) ans = i, ac = mn;
  }
  long long ff, ss;
  for (auto i : mp) {
    long long b1 = -1, b2 = -1;
    long long mnn = min(i.first.first, i.first.second);
    long long p1 = -1, p2 = -1;
    if (mnn <= ac || i.second.size() == 1) continue;
    for (long long j = 0; j < i.second.size(); j++) {
      if (i.second[j].first >= b1) {
        b2 = b1;
        b1 = i.second[j].first;
        p2 = p1;
        p1 = i.second[j].second;
      } else if (i.second[j].first > b2) {
        b2 = i.second[j].first;
        p2 = i.second[j].second;
      }
    }
    if (min(b1 + b2, mnn) > ac) {
      cnt = 2;
      ac = min(b1 + b2, mnn);
      ff = p1, ss = p2;
    }
  }
  cout << cnt << endl;
  if (cnt == 1)
    cout << ans + 1;
  else
    cout << ff + 1 << " " << ss + 1 << endl;
  return 0;
}
