#include <bits/stdc++.h>
using namespace std;
inline long long int read() {
  char c = getchar();
  long long int num, sign = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (num = 0; c >= '0' && c <= '9';) {
    c -= '0';
    num = num * 10 + c;
    c = getchar();
  }
  return num * sign;
}
pair<pair<int, int>, pair<int, int> > pp[100005];
int a[4];
int main() {
  int n;
  n = read();
  int l, r = -1;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) a[j] = read();
    sort(a, a + 3);
    pp[i] = {{a[1], a[2]}, {a[0], i}};
    if (a[0] > ans) ans = a[0], l = i;
  }
  sort(pp + 1, pp + n + 1);
  for (int i = 1; i <= n - 1; i++) {
    if (pp[i].first == pp[i + 1].first) {
      int c = pp[i].second.first + pp[i + 1].second.first;
      int x = min(pp[i].first.first, c);
      if (x > ans) {
        ans = x;
        l = pp[i].second.second;
        r = pp[i + 1].second.second;
      }
    }
  }
  if (r == -1) {
    cout << 1 << endl;
    cout << l << endl;
  } else {
    cout << 2 << endl;
    cout << l << " " << r << endl;
  }
  return 0;
}
