#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  int n;
  cin >> n;
  long long a[n][3];
  set<pair<pair<long long, long long>, pair<long long, long long>>> SS;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }
  for (int i = 0; i < n; i++) sort(a[i], a[i] + 3);
  for (int i = 0; i < n; i++) {
    SS.insert({{a[i][0], a[i][1]}, {a[i][2], i}});
    SS.insert({{a[i][1], a[i][2]}, {a[i][0], i}});
    SS.insert({{a[i][0], a[i][2]}, {a[i][1], i}});
  }
  int p1 = 0;
  int p2 = 0;
  int N = 0;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long temp = max(ans, min(min(a[i][0], a[i][1]), a[i][2]));
    if (temp > ans) {
      ans = temp;
      N = 1;
      p1 = i;
    }
  }
  auto x1 = SS.begin();
  for (auto x2 = ++SS.begin(); x2 != SS.end(); x2++) {
    auto y1 = *x1;
    auto y2 = *x2;
    if ((y1.first.first == y2.first.first) &&
        (y1.first.second == y2.first.second)) {
      long long temp = max(ans, min(min(y2.first.first, y2.first.second),
                                    y1.second.first + y2.second.first));
      if (temp > ans) {
        ans = temp;
        if (y1.second.second == y2.second.second) {
          N = 1;
          p1 = y2.second.second;
        } else {
          N = 2;
          p1 = y1.second.second;
          p2 = y2.second.second;
        }
      }
    }
    x1 = x2;
  }
  if (N == 1) {
    cout << "1\n";
    cout << p1 + 1;
  } else if (N == 2) {
    cout << "2\n";
    cout << p1 + 1 << " " << p2 + 1;
  }
  return 0;
}
