#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, pair<int, int> > tab;
int main() {
  int n, v[3];
  pair<int, int> ans;
  int maior = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &v[0], &v[1], &v[2]);
    sort(v, v + 3);
    for (int j = 0; j < 3; j++)
      for (int k = j + 1; k < 3; k++) {
        pair<int, int> x = tab[make_pair(v[j], v[k])];
        int ind = 3 - j - k;
        int aux[3] = {v[0], v[1], v[2]};
        aux[ind] += x.first;
        sort(aux, aux + 3);
        if (aux[0] > maior) {
          maior = aux[0];
          ans.first = i;
          ans.second = x.second;
        }
      }
    if (tab[make_pair(v[0], v[1])].first < v[2])
      tab[make_pair(v[0], v[1])] = make_pair(v[2], i);
    if (tab[make_pair(v[0], v[2])].first < v[1])
      tab[make_pair(v[0], v[2])] = make_pair(v[1], i);
    if (tab[make_pair(v[1], v[2])].first < v[0])
      tab[make_pair(v[1], v[2])] = make_pair(v[0], i);
  }
  if (ans.first > ans.second) swap(ans.first, ans.second);
  if (ans.first)
    printf("2\n%d %d\n", ans.first, ans.second);
  else
    printf("1\n%d\n", ans.second);
  return 0;
}
