#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n;
int a[N], b[N], c[N];
map<pair<int, int>, pair<int, int> > mtp;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d", &a[i], &b[i], &c[i]);
  }
  double ans = 0;
  int idx = -1;
  for (int i = 1; i <= n; i++) {
    double curr = min(min(a[i], b[i]), c[i]);
    curr /= 2.0;
    if (curr > ans) {
      ans = curr;
      idx = i;
    }
  }
  int idx1 = -1, idx2 = -1;
  for (int i = 1; i <= n; ++i) {
    int aa = a[i];
    int bb = b[i];
    int cc = c[i];
    if (mtp.find({min(aa, bb), max(aa, bb)}) != mtp.end()) {
      int key = mtp[{min(aa, bb), max(aa, bb)}].first;
      int backtrack = mtp[{min(aa, bb), max(aa, bb)}].second;
      double curr = min(min(aa, bb), key + cc);
      curr /= 2.0;
      if (curr > ans) {
        ans = curr;
        idx1 = i;
        idx2 = backtrack;
      }
    }
    if (mtp.find({min(bb, cc), max(bb, cc)}) != mtp.end()) {
      int key = mtp[{min(bb, cc), max(bb, cc)}].first;
      int backtrack = mtp[{min(bb, cc), max(bb, cc)}].second;
      double curr = min(min(bb, cc), key + aa);
      curr /= 2.0;
      if (curr > ans) {
        ans = curr;
        idx1 = i;
        idx2 = backtrack;
      }
    }
    if (mtp.find({min(aa, cc), max(aa, cc)}) != mtp.end()) {
      int key = mtp[{min(aa, cc), max(aa, cc)}].first;
      int backtrack = mtp[{min(aa, cc), max(aa, cc)}].second;
      double curr = min(min(aa, cc), key + bb);
      curr /= 2.0;
      if (curr > ans) {
        ans = curr;
        idx1 = i;
        idx2 = backtrack;
      }
    }
    int x = min(aa, bb);
    int y = max(aa, bb);
    if (mtp.find({x, y}) == mtp.end()) {
      mtp[{x, y}] = {cc, i};
    } else {
      if (cc > mtp[{x, y}].first) {
        mtp[{x, y}] = {cc, i};
      }
    }
    x = min(cc, bb);
    y = max(cc, bb);
    if (mtp.find({x, y}) == mtp.end()) {
      mtp[{x, y}] = {aa, i};
    } else {
      if (aa > mtp[{x, y}].first) {
        mtp[{x, y}] = {aa, i};
      }
    }
    x = min(aa, cc);
    y = max(aa, cc);
    if (mtp.find({x, y}) == mtp.end()) {
      mtp[{x, y}] = {bb, i};
    } else {
      if (bb > mtp[{x, y}].first) {
        mtp[{x, y}] = {bb, i};
      }
    }
  }
  if (idx2 == -1) {
    printf("1\n%d\n", idx);
  } else {
    printf("2\n%d %d\n", idx1, idx2);
  }
}
