#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
struct Node {
  int x, y, z, id;
} aa[N];
bool cmp(Node x, Node 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 ans, k, x, y, n, cnt;
void Up(Node &A, Node &B) {
  if (A.x == B.x && A.y == B.y && A.id != B.id) {
    int num = min(min(A.x, A.y), A.z + B.z);
    if (ans < num) ans = num, k = 2, x = A.id, y = B.id;
  }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    int a, b, c;
    a = read();
    b = read();
    c = read();
    if (a > b) swap(a, b);
    if (a > c) swap(a, c);
    if (b > c) swap(b, c);
    int num = min(min(a, b), c);
    aa[++cnt] = (Node){a, b, c, i};
    aa[++cnt] = (Node){a, c, b, i};
    aa[++cnt] = (Node){b, c, a, i};
    if (ans < num) {
      k = 1;
      x = i;
      ans = num;
    }
  }
  sort(aa + 1, aa + cnt + 1, cmp);
  for (int i = 1; i <= cnt; i++)
    for (int j = 1; j <= 10 && i + j <= cnt; j++) Up(aa[i], aa[i + j]);
  if (k == 1)
    printf("1\n%d", x);
  else
    printf("2\n%d %d", x, y);
  return 0;
}
