#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 8;
map<pair<int, int>, pair<int, int> > f;
int a[N], b[N], c[N];
void make(int x, int y, int z, int id) {
  pair<int, int> i = make_pair(x, y);
  if (!f[i].second or z > f[i].first) f[i] = make_pair(z, id);
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    if (a[i] > b[i]) swap(a[i], b[i]);
    if (a[i] > c[i]) swap(a[i], c[i]);
    if (b[i] > c[i]) swap(b[i], c[i]);
    make(b[i], c[i], a[i], i);
  }
  int id1, id2, id3;
  int res = 0;
  for (int i = 1; i <= n; i++) {
    if (res < a[i]) {
      res = a[i];
      id1 = i;
    }
  }
  int res1 = 0;
  for (int i = 1; i <= n; i++) {
    pair<int, int> data = f[make_pair(b[i], c[i])];
    if (data.second and data.second != i) {
      int d = min(b[i], a[i] + data.first);
      int x2 = min(i, data.second);
      int x3 = i + data.second - x2;
      if (res1 < d) {
        id2 = x2;
        id3 = x3;
        res1 = d;
      } else if (res1 == d) {
        if (id2 > x2) {
          id2 = x2;
          id3 = x3;
        } else if (id2 == x2 and id3 > x3) {
          id3 = x3;
        }
      }
    }
  }
  if (res >= res1) {
    cout << 1 << endl << id1;
  } else {
    cout << 2 << endl << id2 << ' ' << id3;
  }
}
