#include <bits/stdc++.h>
using namespace std;
struct par {
  int x, y;
  par(){};
  par(int _x, int _y) : x(_x), y(_y){};
  bool operator<(const par &p) const {
    if (x == p.x) return y < p.y;
    return x < p.x;
  }
};
int n, a[100005], b[100005], c[100005], maxx, k, p1, p2;
map<par, int> M, M_pos;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i] >> b[i] >> c[i];
    if (min(a[i], min(b[i], c[i])) > maxx) {
      maxx = min(a[i], min(b[i], c[i]));
      k = 1;
      p1 = i;
      p2 = -1;
    }
    if (M_pos[par(a[i], b[i])] > 0 && M_pos[par(a[i], b[i])] < i) {
      if (min(a[i], min(b[i], c[i] + M[par(a[i], b[i])])) > maxx) {
        maxx = min(a[i], min(b[i], c[i] + M[par(a[i], b[i])]));
        k = 2;
        p1 = i;
        p2 = M_pos[par(a[i], b[i])];
      }
      if (c[i] > M[par(a[i], b[i])]) {
        M[par(a[i], b[i])] = c[i];
        M_pos[par(a[i], b[i])] = i;
      }
    } else {
      M[par(a[i], b[i])] = c[i];
      M_pos[par(a[i], b[i])] = i;
    }
    if (M_pos[par(b[i], a[i])] > 0 && M_pos[par(b[i], a[i])] < i) {
      if (min(a[i], min(b[i], c[i] + M[par(b[i], a[i])])) > maxx) {
        maxx = min(a[i], min(b[i], c[i] + M[par(b[i], a[i])]));
        k = 2;
        p1 = i;
        p2 = M_pos[par(b[i], a[i])];
      }
      if (c[i] > M[par(b[i], a[i])]) {
        M[par(b[i], a[i])] = c[i];
        M_pos[par(b[i], a[i])] = i;
      }
    } else {
      M[par(b[i], a[i])] = c[i];
      M_pos[par(b[i], a[i])] = i;
    }
    if (M_pos[par(b[i], c[i])] > 0 && M_pos[par(b[i], c[i])] < i) {
      if (min(b[i], min(c[i], a[i] + M[par(b[i], c[i])])) > maxx) {
        maxx = min(b[i], min(c[i], a[i] + M[par(b[i], c[i])]));
        k = 2;
        p1 = i;
        p2 = M_pos[par(b[i], c[i])];
      }
      if (a[i] > M[par(b[i], c[i])]) {
        M[par(b[i], c[i])] = a[i];
        M_pos[par(b[i], c[i])] = i;
      }
    } else {
      M[par(b[i], c[i])] = a[i];
      M_pos[par(b[i], c[i])] = i;
    }
    if (M_pos[par(c[i], b[i])] > 0 && M_pos[par(c[i], b[i])] < i) {
      if (min(b[i], min(c[i], a[i] + M[par(c[i], b[i])])) > maxx) {
        maxx = min(b[i], min(c[i], a[i] + M[par(c[i], b[i])]));
        k = 2;
        p1 = i;
        p2 = M_pos[par(c[i], b[i])];
      }
      if (a[i] > M[par(c[i], b[i])]) {
        M[par(c[i], b[i])] = a[i];
        M_pos[par(c[i], b[i])] = i;
      }
    } else {
      M[par(c[i], b[i])] = a[i];
      M_pos[par(c[i], b[i])] = i;
    }
    if (M_pos[par(a[i], c[i])] > 0 && M_pos[par(a[i], c[i])] < i) {
      if (min(a[i], min(c[i], b[i] + M[par(a[i], c[i])])) > maxx) {
        maxx = min(a[i], min(c[i], b[i] + M[par(a[i], c[i])]));
        k = 2;
        p1 = i;
        p2 = M_pos[par(a[i], c[i])];
      }
      if (b[i] > M[par(a[i], c[i])]) {
        M[par(a[i], c[i])] = b[i];
        M_pos[par(a[i], c[i])] = i;
      }
    } else {
      M[par(a[i], c[i])] = b[i];
      M_pos[par(a[i], c[i])] = i;
    }
    if (M_pos[par(c[i], a[i])] > 0 && M_pos[par(c[i], a[i])] < i) {
      if (min(a[i], min(c[i], b[i] + M[par(c[i], a[i])])) > maxx) {
        maxx = min(a[i], min(c[i], b[i] + M[par(c[i], a[i])]));
        k = 2;
        p1 = i;
        p2 = M_pos[par(c[i], a[i])];
      }
      if (b[i] > M[par(c[i], a[i])]) {
        M[par(c[i], a[i])] = b[i];
        M_pos[par(c[i], a[i])] = i;
      }
    } else {
      M[par(c[i], a[i])] = b[i];
      M_pos[par(c[i], a[i])] = i;
    }
  }
  if (k == 1)
    cout << k << endl << p1 << endl;
  else if (k == 2)
    cout << k << endl << p1 << " " << p2 << endl;
  return 0;
}
