#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
struct node {
  long long a, b, c;
} p[N];
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first > b.first;
}
map<pair<long long, long long>, set<pair<long long, long long>>> mp;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long mx = -1;
  int pos;
  for (int i = 1; i <= n; i++) {
    long long c[5];
    for (int j = 1; j <= 3; j++) cin >> c[j];
    sort(c + 1, c + 4);
    long long mmax = min(min(c[1], c[2]), c[3]);
    if (mmax > mx) mx = mmax, pos = i;
    p[i].a = c[1], p[i].b = c[2], p[i].c = c[3];
    mp[{c[1], c[2]}].insert(make_pair(c[3], i * 1ll));
    mp[{c[1], c[3]}].insert(make_pair(c[2], i * 1ll));
    mp[{c[2], c[3]}].insert(make_pair(c[1], i * 1ll));
  }
  pair<long long, long long> res = {-1, -1};
  bool flag = 1;
  for (auto t : mp) {
    long long a, b, c;
    a = t.first.first;
    b = t.first.second;
    if (t.second.size() <= 1) continue;
    pair<long long, long long> t1, t2;
    vector<pair<long long, long long>> tt;
    for (auto x : t.second) tt.push_back(x);
    sort(tt.begin(), tt.end(), cmp);
    t1 = tt[0];
    t2 = tt[1];
    c = tt[1].first + tt[0].first;
    long long mmn = min(min(a, b), c);
    if (mmn > mx) {
      flag = 0;
      res = {t1.second, t2.second};
    }
  }
  if (flag) {
    cout << 1 << endl;
    cout << pos << endl;
  } else {
    cout << 2 << endl;
    cout << res.first << " " << res.second << endl;
  }
  return 0;
}
