#include <bits/stdc++.h>
using namespace std;
int n;
map<pair<long long, long long>, pair<long long, long long> > mp1, mp2, mp3;
long long s[100005][4];
long long res = 0;
long long k, vt1, vt2;
void sxep(int i) {
  int a[3];
  a[0] = s[i][0];
  a[1] = s[i][1];
  a[2] = s[i][2];
  sort(a, a + 3);
  s[i][0] = a[0];
  s[i][1] = a[1];
  s[i][2] = a[2];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long t, a, b, c;
    cin >> s[i][0] >> s[i][1] >> s[i][2];
    sxep(i);
    a = s[i][0];
    b = s[i][1];
    c = s[i][2];
    t = mp3[pair<long long, long long>(b, c)].first;
    if (t < a)
      mp3[pair<long long, long long>(b, c)] = pair<long long, long long>(a, i);
  }
  for (int i = 1; i <= n; i++) {
    long long ans = s[i][0];
    if (ans > res) {
      res = ans;
      k = 1;
      vt1 = i;
    }
    pair<long long, long long> tg, tmp;
    tg = pair<long long, long long>(s[i][1], s[i][2]);
    tmp = mp3[tg];
    if (tmp.second != i) {
      ans += tmp.first;
      ans = min(ans, s[i][1]);
      if (ans > res) {
        res = ans;
        k = 2;
        vt1 = i;
        vt2 = tmp.second;
      }
    }
  }
  cout << k << '\n';
  cout << vt1 << ' ';
  if (k == 2) cout << vt2;
}
