#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, pair<long long, int>> unq;
class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    long long mx = 0;
    int ans = 0;
    int k1 = 0;
    int k2 = 0;
    for (int i = 0; i < n; i++) {
      long long a, b, c;
      in >> a >> b >> c;
      vector<long long> cr;
      cr.push_back(a);
      cr.push_back(b);
      cr.push_back(c);
      sort(cr.begin(), cr.end());
      if (cr[0] > mx) {
        mx = cr[0];
        ans = 1;
        k1 = i + 1;
      }
      pair<long long, long long> cur = {cr[1], cr[2]};
      if (unq.count(cur) == 0) {
        unq.insert({cur, {cr[0], i + 1}});
      } else {
        long long sm = unq[cur].first + cr[0];
        long long cm = min(sm, cr[1]);
        if (cm > mx) {
          mx = cm;
          ans = 2;
          k1 = unq[cur].second;
          k2 = i + 1;
        }
        pair<long long, int> nv;
        if (unq[cur].first < cr[0]) {
          nv = {max(unq[cur].first, cr[0]), i + 1};
        } else {
          nv = {max(unq[cur].first, cr[0]), unq[cur].second};
        }
        unq[cur] = nv;
      }
    }
    out << ans << endl;
    if (ans == 1) {
      out << k1;
    } else {
      out << k1 << " " << k2;
    }
  }
};
void solve(std::istream& in, std::ostream& out) {
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
