#include <bits/stdc++.h>
using namespace std;
int main() {
  std::map<pair<int, int>, int> m;
  std::map<pair<int, int>, int> n;
  int k;
  scanf("%d", &k);
  int m1 = -1;
  int m2 = -1;
  int r_max = -1;
  for (int i = 0; i < k; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    pair<int, int> p1 = {min(a, b), max(a, b)}, p2 = {min(b, c), max(b, c)},
                   p3 = {min(a, c), max(a, c)};
    int v = min(min(c + m[p1], a), b);
    if (r_max < v) {
      r_max = v;
      m1 = i + 1;
      m2 = n[p1];
    }
    if (m[p1] < c) {
      m[p1] = c;
      n[p1] = i + 1;
    }
    v = min(min(a + m[p2], b), c);
    if (r_max < v) {
      r_max = v;
      m1 = i + 1;
      m2 = n[p2];
    }
    if (m[p2] < a) {
      m[p2] = a;
      n[p2] = i + 1;
    }
    v = min(min(b + m[p3], a), c);
    if (r_max < v) {
      r_max = v;
      m1 = i + 1;
      m2 = n[p3];
    }
    if (m[p3] < b) {
      m[p3] = b;
      n[p3] = i + 1;
    }
  }
  if (m2 == 0) {
    cout << 1 << endl;
    cout << m1 << endl;
  } else {
    cout << 2 << endl;
    cout << m2 << " " << m1 << endl;
  }
}
