#include <bits/stdc++.h>
using namespace std;
bool compare(const pair<long long, long long>& lhs,
             const pair<long long, long long>& rhs) {
  return lhs.first < rhs.first;
}
int main() {
  ios::sync_with_stdio(0);
  long long n;
  cin >> n;
  long long a[3];
  map<pair<long long, long long>, vector<pair<long long, long long> > > mp;
  set<pair<long long, long long> > visited;
  long long onemax = 0;
  long long oneans;
  for (long long i = 1; i <= n; i++) {
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    pair<long long, long long> temp, gemp;
    if (a[0] > onemax) {
      onemax = a[0];
      oneans = i;
    }
    if (a[0] == a[1] && a[2] == a[1]) {
      temp = make_pair(a[0], a[1]);
      gemp = {a[2], i};
      mp[temp].push_back(gemp);
      visited.insert(temp);
    } else if (a[0] == a[1]) {
      temp = make_pair(a[0], a[1]);
      gemp = {a[2], i};
      mp[temp].push_back(gemp);
      visited.insert(temp);
      temp = make_pair(a[0], a[2]);
      gemp = {a[1], i};
      mp[temp].push_back(gemp);
      visited.insert(temp);
    } else if (a[1] == a[2]) {
      temp = make_pair(a[0], a[1]);
      gemp = {a[2], i};
      mp[temp].push_back(gemp);
      visited.insert(temp);
      temp = make_pair(a[1], a[2]);
      gemp = {a[0], i};
      mp[temp].push_back(gemp);
      visited.insert(temp);
    } else {
      temp = make_pair(a[0], a[1]);
      gemp = {a[2], i};
      mp[temp].push_back(gemp);
      visited.insert(temp);
      temp = make_pair(a[0], a[2]);
      gemp = {a[1], i};
      mp[temp].push_back(gemp);
      visited.insert(temp);
      temp = make_pair(a[1], a[2]);
      gemp = {a[0], i};
      mp[temp].push_back(gemp);
      visited.insert(temp);
    }
  }
  long long maxi = 0;
  pair<long long, long long> ans;
  for (set<pair<long long, long long> >::iterator it = visited.begin();
       it != visited.end(); it++) {
    long long len = mp[(*it)].size();
    if (len > 1) {
      sort(mp[(*it)].begin(), mp[(*it)].end(), compare);
      if (min((*it).first,
              mp[(*it)][len - 1].first + mp[(*it)][len - 2].first) > maxi) {
        maxi = min((*it).first,
                   mp[(*it)][len - 1].first + mp[(*it)][len - 2].first);
        ans = make_pair(
            min(mp[(*it)][len - 1].second, mp[(*it)][len - 2].second),
            max(mp[(*it)][len - 1].second, mp[(*it)][len - 2].second));
      }
    }
  }
  if (onemax >= maxi) {
    cout << 1 << endl;
    cout << oneans;
  } else {
    cout << 2 << endl;
    cout << ans.first << " " << ans.second;
  }
  return 0;
}
