#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, pair<int, int>> ma;
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  int ans = 0;
  int how = 0;
  int x[2] = {0, 0};
  for (int i = 0; i < n; i++) {
    int ar[3];
    cin >> ar[0] >> ar[1] >> ar[2];
    sort(ar, ar + 3);
    if (ans < ar[0]) {
      ans = ar[0];
      how = 1;
      x[0] = i + 1;
    }
    pair<int, int> p1 = {ar[0], ar[1]};
    int P1 = ar[2];
    pair<int, int> p2 = {ar[0], ar[2]};
    int P2 = ar[1];
    pair<int, int> p3 = {ar[1], ar[2]};
    int P3 = ar[0];
    pair<int, int> chkp1 = ma[p1];
    int tp1 = min(ar[0], min(ar[1], P1 + chkp1.first));
    if (tp1 > ans) {
      ans = tp1;
      how = 2;
      x[0] = i + 1;
      x[1] = chkp1.second;
    }
    if (P1 > chkp1.first) {
      ma[p1] = {P1, i + 1};
    }
    pair<int, int> chkp2 = ma[p2];
    int tp2 = min(ar[0], min(ar[2], P2 + chkp2.first));
    if (tp2 > ans) {
      ans = tp2;
      how = 2;
      x[0] = i + 1;
      x[1] = chkp2.second;
    }
    if (P2 > chkp2.first) {
      ma[p2] = {P2, i + 1};
    }
    pair<int, int> chkp3 = ma[p3];
    int tp3 = min(ar[1], min(ar[2], P3 + chkp3.first));
    if (tp3 > ans) {
      ans = tp3;
      how = 2;
      x[0] = i + 1;
      x[1] = chkp3.second;
    }
    if (P3 > chkp3.first) {
      ma[p3] = {P3, i + 1};
    }
  }
  cout << how << "\n";
  for (int i = 0; i < how; i++) {
    cout << x[i] << " ";
  }
  return 0;
}
