#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000 * 1000 * 1000, N = 3;
map<pair<int, int>, pair<int, int>> maxPos;
void updAns(int &curR, vector<int> &ans, const vector<int> &sides, int id) {
  int r = sides[0];
  if (r > curR) {
    curR = r;
    ans[0] = id + 1;
    ans[1] = -1;
  }
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      int nonUsedSide = 3 - i - j;
      pair<int, int> curSides = make_pair(sides[i], sides[j]);
      if (maxPos.find(curSides) != maxPos.end()) {
        r = min(sides[i], sides[j]);
        int thirdSide = sides[nonUsedSide] + maxPos[curSides].first;
        r = min(r, thirdSide);
      }
      if (r > curR && maxPos[curSides].second != id + 1) {
        curR = r;
        ans[0] = maxPos[curSides].second;
        ans[1] = id + 1;
      }
      if (maxPos.find(curSides) == maxPos.end() ||
          maxPos[curSides].first < sides[nonUsedSide]) {
        maxPos[curSides] = make_pair(sides[nonUsedSide], id + 1);
      }
    }
  }
  return;
}
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1) {
    cout << "1\n1\n";
    return 0;
  }
  int r = 0;
  vector<int> ans(2), sides(N);
  for (int i = 0; i < n; ++i) {
    for (int i = 0; i < N; ++i) scanf("%d", &sides[i]);
    sort(sides.begin(), sides.end());
    updAns(r, ans, sides, i);
  }
  if (ans[1] == -1) {
    cout << "1\n" << ans[0];
    return 0;
  }
  cout << "2\n" << ans[0] << " " << ans[1] << endl;
  return 0;
}
