#include <bits/stdc++.h>
inline int min(int x, int y) { return x < y ? x : y; }
inline int min(int x, int y, int z) { return min(min(x, y), z); }
int n, m, p[2], i, k, a[3], u, v;
struct dat {
  int x, y;
  inline dat(int a = 0, int b = 0) : x(a), y(b) {}
  inline bool operator<(const dat& p) const {
    return x != p.x ? x < p.x : y < p.y;
  }
} r, t;
std::map<dat, dat> A;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    for (k = 0; k < 3; ++k) scanf("%d", &a[k]);
    std::sort(a, a + 3);
    v = min(a[0], a[1], a[2]);
    if (u < v) u = v, m = 1, p[0] = i;
    t = dat(a[0], a[1]);
    if (A.find(t) != A.end()) {
      r = A[t], v = min(a[0], a[1], a[2] + r.y);
      if (u < v) u = v, m = 2, p[1] = i, p[0] = r.x;
    }
    t = dat(a[0], a[2]);
    if (A.find(t) != A.end()) {
      r = A[t], v = min(a[0], a[2], a[1] + r.y);
      if (u < v) u = v, m = 2, p[1] = i, p[0] = r.x;
    }
    t = dat(a[1], a[2]);
    if (A.find(t) != A.end()) {
      r = A[t], v = min(a[1], a[2], a[0] + r.y);
      if (u < v) u = v, m = 2, p[1] = i, p[0] = r.x;
    }
    t = dat(a[0], a[1]);
    if (A[t].y < a[2]) A[t] = dat(i, a[2]);
    t = dat(a[0], a[2]);
    if (A[t].y < a[1]) A[t] = dat(i, a[1]);
    t = dat(a[1], a[2]);
    if (A[t].y < a[0]) A[t] = dat(i, a[0]);
  }
  printf("%d\n", m);
  for (k = 0; k < m; ++k) printf("%d%c", p[k], k < m - 1 ? ' ' : '\n');
  return 0;
}
