#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n;
struct kaka {
  int x, y, z, id;
} a[N];
bool cmp(kaka x, kaka y) {
  if (x.x != y.x) return x.x < y.x;
  if (x.y != y.y) return x.y < y.y;
  return x.z < y.z;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int tmp[3];
    scanf("%d %d %d", tmp, tmp + 1, tmp + 2);
    sort(tmp, tmp + 3);
    a[i].x = tmp[2];
    a[i].y = tmp[1];
    a[i].z = tmp[0];
    a[i].id = i;
  }
  sort(a + 1, a + n + 1, cmp);
  int i = 1;
  int res = 0;
  pair<int, int> ka;
  while (i <= n) {
    int j = i;
    if (i == n) {
      if (res < a[i].z) {
        ka.first = a[i].id;
        ka.second = 0;
        res = a[i].z;
      }
      break;
    }
    while (j < n && a[j].x == a[j + 1].x && a[j].y == a[j + 1].y) j++;
    if (j == i) {
      if (res < a[i].z) {
        ka.first = a[i].id;
        ka.second = 0;
        res = a[i].z;
      }
    } else {
      int tmp = min(a[j].z + a[j - 1].z, min(a[j].y, a[j - 1].y));
      if (res < tmp) {
        ka.first = a[j].id;
        ka.second = a[j - 1].id;
        res = tmp;
      }
    }
    i = j + 1;
  }
  if (ka.second)
    cout << 2 << endl << ka.first << " " << ka.second << endl;
  else
    cout << 1 << endl << ka.first << endl;
}
