#include <bits/stdc++.h>
using namespace std;
struct hui {
  long long mx1 = 0, mx2 = 0, ind1 = -1, ind2 = -1;
};
void gg(long long a, long long b, long long c, long long ind,
        map<pair<long long, long long>, hui> &v) {
  auto temp = v[{a, b}];
  if (temp.ind1 - 1 == ind || temp.ind2 - 1 == ind) return;
  if (temp.mx1 == -1) {
    temp.mx1 = c;
    temp.ind1 = ind + 1;
  } else if (temp.mx2 == -1) {
    temp.mx2 = c;
    temp.ind2 = ind + 1;
  } else if (c > temp.mx2) {
    temp.mx2 = c;
    temp.ind2 = ind + 1;
  }
  if (temp.mx2 > temp.mx1) {
    swap(temp.mx2, temp.mx1);
    swap(temp.ind2, temp.ind1);
  }
  v[{a, b}] = temp;
}
long long min(long long a, long long b, long long c) {
  return min(a, min(b, c));
}
class TaskD {
 public:
  void solve(istream &cin, ostream &cout) {
    map<pair<long long, long long>, hui> v;
    long long n;
    cin >> n;
    for (long long i = 0; i < n; i++) {
      long long a, b, c;
      cin >> a >> b >> c;
      gg(a, b, c, i, v);
      gg(a, c, b, i, v);
      gg(b, a, c, i, v);
      gg(b, c, a, i, v);
      gg(c, a, b, i, v);
      gg(c, b, a, i, v);
    }
    long long mx = 0;
    long long mx1 = -1;
    long long mx2 = -1;
    for (auto k : v) {
      long long nw =
          min(k.first.first, k.first.second, k.second.mx1 + k.second.mx2);
      if (nw > mx) {
        mx = nw;
        mx1 = k.second.ind1;
        mx2 = k.second.ind2;
      }
    }
    if (mx2 == -1) {
      cout << 1 << endl << mx1;
      return;
    }
    cout << 2 << endl << mx1 << ' ' << mx2;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  TaskD solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
