#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, pair<int, int> > vis;
int ans, a1, a2;
int main() {
  int n;
  scanf("%d", &n);
  int a[3];
  pair<int, int> fir;
  pair<int, int> sec;
  int mini;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d%d", &a[0], &a[1], &a[2]);
    sort(a, a + 3);
    if (a[0] > ans) {
      ans = a[0];
      a1 = i;
      a2 = 1e9;
    }
    fir = make_pair(a[0], a[1]);
    mini = min(fir.first, fir.second);
    sec = vis[fir];
    if (sec.first != 0) {
      if (min(sec.second + a[2], mini) > ans) {
        a1 = sec.first - 1;
        a2 = i;
        ans = min(sec.second + a[2], mini);
      }
    }
    fir = make_pair(a[1], a[2]);
    mini = min(fir.first, fir.second);
    sec = vis[fir];
    if (sec.first != 0) {
      if (min(sec.second + a[0], mini) > ans) {
        a1 = sec.first - 1;
        a2 = i;
        ans = min(sec.second + a[0], mini);
      }
    }
    fir = make_pair(a[0], a[2]);
    mini = min(fir.first, fir.second);
    sec = vis[fir];
    if (sec.first != 0) {
      if (min(sec.second + a[1], mini) > ans) {
        a1 = sec.first - 1;
        a2 = i;
        ans = min(sec.second + a[1], mini);
      }
    }
    fir = make_pair(a[0], a[1]);
    sec = vis[fir];
    if (sec.second < a[2]) {
      sec.second = a[2];
      sec.first = i + 1;
    }
    vis[fir] = sec;
    fir = make_pair(a[0], a[2]);
    sec = vis[fir];
    if (sec.second < a[1]) {
      sec.second = a[1];
      sec.first = i + 1;
    }
    vis[fir] = sec;
    fir = make_pair(a[1], a[2]);
    sec = vis[fir];
    if (sec.second < a[0]) {
      sec.second = a[0];
      sec.first = i + 1;
    }
    vis[fir] = sec;
  }
  cerr << ans;
  if (a2 == int(1e9)) {
    cout << 1 << endl << a1 + 1;
  } else {
    cout << 2 << endl << a1 + 1 << " " << a2 + 1;
  }
}
