#include <bits/stdc++.h>
struct Side {
  int x, y;
  Side(int x, int y) : x(x), y(y) {}
};
struct Part {
  int id, z;
  Part() {}
  Part(int id, int z) : id(id), z(z) {}
};
struct Answer {
  int a, b;
  Answer(){};
  Answer(int a, int b) : a(a), b(b) {}
};
bool operator<(const Side &left, const Side &right) {
  if (left.x != right.x) {
    return left.x < right.x;
  }
  return left.y < right.y;
}
int min(int x, int y, int z) { return std::min(x, std::min(y, z)); }
void check(int id, int x, int y, int z, std::map<Side, Part> &sides,
           Answer &ans, int &bestV) {
  if (x > y) {
    check(id, y, x, z, sides, ans, bestV);
    return;
  }
  auto it = sides.find(Side(x, y));
  if (it == sides.end()) {
    return;
  }
  z += (*it).second.z;
  int minV = min(x, y, z);
  if (minV > bestV) {
    bestV = minV;
    ans.a = (*it).second.id;
    ans.b = id;
  }
}
void add(int id, int x, int y, int z, std::map<Side, Part> &sides) {
  if (x > y) {
    add(id, y, x, z, sides);
    return;
  }
  auto it = sides.find(Side(x, y));
  if (it != sides.end()) {
    if ((*it).second.z >= z) {
      return;
    }
  }
  sides[Side(x, y)] = Part(id, z);
}
int main() {
  std::map<Side, Part> sides;
  int n;
  scanf("%d", &n);
  Answer ans;
  int bestV = 0;
  for (int i = 1; i <= n; i++) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    int minV = min(x, y, z);
    if (minV > bestV) {
      bestV = minV;
      ans = Answer(i, -1);
    }
    check(i, x, y, z, sides, ans, bestV);
    check(i, x, z, y, sides, ans, bestV);
    check(i, y, z, x, sides, ans, bestV);
    add(i, x, y, z, sides);
    add(i, x, z, y, sides);
    add(i, y, z, x, sides);
  }
  if (ans.b == -1) {
    printf("1\n%d", ans.a);
  } else {
    printf("2\n%d %d", ans.a, ans.b);
  }
  return 0;
}
