#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int n;
long long arr[MAXN][3];
map<pair<long long, long long>, pair<long long, int> > height;
void update(long long x, long long y, long long z, int id) {
  if (height.find(make_pair((x), (y))) == height.end())
    height[make_pair((x), (y))] = make_pair((z), (id));
  else
    height[make_pair((x), (y))] =
        max(height[make_pair((x), (y))], make_pair((z), (id)));
}
int main() {
  cin >> n;
  int idx1 = 0, idx2[2] = {0, 0};
  long long best1 = 0, best2 = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    sort(arr[i], arr[i] + 3);
    if (arr[i][0] > best1) {
      best1 = arr[i][0];
      idx1 = i;
    }
    if (height.find(make_pair((arr[i][1]), (arr[i][2]))) != height.end()) {
      long long t =
          min(arr[i][0] + height[make_pair((arr[i][1]), (arr[i][2]))].first,
              min(arr[i][1], arr[i][2]));
      if (t > best2) {
        idx2[0] = i;
        idx2[1] = height[make_pair((arr[i][1]), (arr[i][2]))].second;
        best2 = t;
      }
    }
    update(arr[i][0], arr[i][1], arr[i][2], i);
    update(arr[i][0], arr[i][2], arr[i][1], i);
    update(arr[i][1], arr[i][2], arr[i][0], i);
  }
  if (best1 > best2)
    cout << 1 << endl << idx1 << endl;
  else
    cout << 2 << endl << idx2[0] << ' ' << idx2[1] << endl;
  return 0;
}
