#include <bits/stdc++.h>
using namespace std;
long long n, a[((long long)301 * 1000)], b[((long long)301 * 1000)],
    c[((long long)301 * 1000)], ans1, id1, ans2;
map<pair<long long, long long>, pair<long long, long long> > mp;
pair<long long, long long> id2;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    if (ans1 < min({a[i], b[i], c[i]})) ans1 = min({a[i], b[i], c[i]}), id1 = i;
    pair<long long, long long> ex = mp[{a[i], b[i]}];
    if (ex.first) {
      long long res = min({a[i], b[i], c[i] + ex.first});
      if (ans2 < res) ans2 = res, id2 = {ex.second, i};
    }
    ex = mp[{b[i], a[i]}];
    if (ex.first) {
      long long res = min({a[i], b[i], c[i] + ex.first});
      if (ans2 < res) ans2 = res, id2 = {ex.second, i};
    }
    ex = mp[{b[i], c[i]}];
    if (ex.first) {
      long long res = min({c[i], b[i], a[i] + ex.first});
      if (ans2 < res) ans2 = res, id2 = {ex.second, i};
    }
    ex = mp[{c[i], b[i]}];
    if (ex.first) {
      long long res = min({c[i], b[i], a[i] + ex.first});
      if (ans2 < res) ans2 = res, id2 = {ex.second, i};
    }
    ex = mp[{c[i], a[i]}];
    if (ex.first) {
      long long res = min({a[i], c[i], b[i] + ex.first});
      if (ans2 < res) ans2 = res, id2 = {ex.second, i};
    }
    ex = mp[{a[i], c[i]}];
    if (ex.first) {
      long long res = min({a[i], c[i], b[i] + ex.first});
      if (ans2 < res) ans2 = res, id2 = {ex.second, i};
    }
    if (mp[{a[i], b[i]}].first < c[i]) mp[{a[i], b[i]}] = {c[i], i};
    if (mp[{a[i], c[i]}].first < b[i]) mp[{a[i], c[i]}] = {b[i], i};
    if (mp[{c[i], b[i]}].first < a[i]) mp[{c[i], b[i]}] = {a[i], i};
  }
  if (ans1 > ans2) {
    cout << "1\n" << id1 << "\n";
    return 0;
  }
  cout << "2\n" << id2.first << " " << id2.second << "\n";
  return 0;
}
