#include <bits/stdc++.h>
using namespace std;
const long long INF = 4000000000000000000LL;
struct rect {
  int a, b, c, id;
  bool operator<(const rect &p) const {
    if (a == p.a) {
      if (b == p.b) {
        if (c == p.c) {
          return id < p.id;
        }
        return c < p.c;
      }
      return b < p.b;
    }
    return a < p.a;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<rect> b(n);
  for (int i = 0; i <= n - 1; i++) {
    vector<int> ara(3);
    for (int j = 0; j <= 2; j++) {
      cin >> ara[j];
    }
    b[i].a = *max_element(ara.begin(), ara.end());
    b[i].c = *min_element(ara.begin(), ara.end());
    b[i].b = ara[0] + ara[1] + ara[2] - b[i].a - b[i].c;
    b[i].id = i + 1;
  }
  sort(b.begin(), b.end());
  long long ans = 0, one = 0, two = -1;
  for (int i = 0; i <= n - 1; i++) {
    if (ans < b[i].c) {
      ans = b[i].c;
      one = b[i].id;
      two = -1;
    }
    if (i > 0 && b[i - 1].a == b[i].a && b[i - 1].b == b[i].b) {
      int t = min(b[i].b, b[i - 1].c + b[i].c);
      if (ans < t) {
        ans = t;
        one = b[i - 1].id;
        two = b[i].id;
      }
    }
  }
  if (two == -1) {
    cout << 1 << endl << one << endl;
  } else
    cout << 2 << endl << one << " " << two << endl;
}
