#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  map<pair<int, int>, vector<pair<int, int>>> m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b, c;
    vector<int> k;
    cin >> a >> b >> c;
    k.push_back(a);
    k.push_back(b);
    k.push_back(c);
    sort(k.begin(), k.end());
    a = k[0];
    b = k[1];
    c = k[2];
    if (a == b && b == c) {
      m[{a, b}].push_back({c, i});
    } else {
      if ((a == b && a != c) || (a == c && a != b)) {
        m[{a, b}].push_back({c, i});
        m[{a, c}].push_back({b, i});
      } else {
        if (b == c && b != a) {
          m[{a, b}].push_back({c, i});
          m[{b, c}].push_back({a, i});
        } else {
          m[{a, b}].push_back({c, i});
          m[{b, c}].push_back({a, i});
          m[{a, c}].push_back({b, i});
        }
      }
    }
  }
  auto it = m.begin();
  int ma = 0;
  auto p = m.begin();
  int g = 0;
  int l = 0;
  for (auto i = it; i != m.end(); i++) {
    int j, r;
    sort(i->second.begin(), i->second.end(), greater<pair<int, int>>());
    if (i->second.size() >= 2) {
      r = i->second[0].first + i->second[1].first;
      j = 2;
    } else {
      r = i->second[0].first;
      j = 1;
    }
    g = min((i->first).first, r);
    if (g > ma) {
      ma = g;
      p = i;
      l = j;
    }
  }
  cout << l << endl;
  for (int i = 0; i < l; i++) cout << p->second[i].second + 1 << " ";
  cout << endl;
  return 0;
}
