#include <bits/stdc++.h>
using namespace std;
const int N = 100009;
int n, ans = 0, k = 1, c1 = 0, c2 = 0, a[3] = {};
map<pair<int, int>, set<pair<int, int> > > b;
int min(int a, int b, int c) {
  if (a <= b && a <= c) return a;
  if (b <= a && b <= c) return b;
  return c;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) scanf("%d", &a[j]);
    sort(a, a + 3);
    b[pair<int, int>(a[0], a[1])].insert(pair<int, int>(a[2], i));
    b[pair<int, int>(a[0], a[2])].insert(pair<int, int>(a[1], i));
    b[pair<int, int>(a[1], a[2])].insert(pair<int, int>(a[0], i));
    if (ans < a[0]) ans = a[0], c1 = i;
  }
  for (map<pair<int, int>, set<pair<int, int> > >::iterator it = b.begin();
       it != b.end(); it++)
    if (it->second.size() > 1) {
      set<pair<int, int> >::iterator it1 = it->second.end();
      int third = (*--it1).first + (*--it1).first;
      if (min((it->first).first, (it->first).second, third) > ans) {
        ans = min((it->first).first, (it->first).second, third);
        k = 2;
        c1 = (*it1).second;
        c2 = (*++it1).second;
      }
    }
  if (k == 1)
    printf("1\n%d\n", c1);
  else
    printf("2\n%d %d\n", c1, c2);
  return 0;
}
