#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
struct node {
  int x, y, z;
  int pos;
} s[N];
bool cmp(node s1, node s2) {
  if (s1.z == s2.z) {
    return s1.y > s2.y;
    if (s1.y == s2.y) return s1.x > s2.x;
  }
  return s1.z > s2.z;
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL), cout.tie(NULL);
  int n, maxn = -1, ans;
  int t[3];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[0] >> t[1] >> t[2];
    sort(t, t + 3);
    s[i].x = t[0], s[i].y = t[1], s[i].z = t[2], s[i].pos = i + 1;
    if (s[i].x > maxn) {
      ans = i + 1;
      maxn = s[i].x;
    }
  }
  sort(s, s + n, cmp);
  int flag = 0;
  int a, b;
  for (int i = 0; i < n - 1; i++) {
    if (s[i].z == s[i + 1].z && s[i].y == s[i + 1].y) {
      int t = min(s[i].y, s[i].x + s[i + 1].x);
      if (t > maxn) {
        maxn = t;
        a = s[i].pos, b = s[i + 1].pos;
        flag = 1;
      }
    }
  }
  if (flag)
    cout << "2" << '\n' << a << " " << b << '\n';
  else
    cout << "1" << '\n' << ans << '\n';
  return 0;
}
