#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a, b, c;
  tuple<int, int, int, int> sq[100000];
  int mx = 0, ind1 = 0, ind2 = -1;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c;
    get<0>(sq[i]) = min(a, min(b, c));
    get<2>(sq[i]) = max(a, max(b, c));
    get<1>(sq[i]) = a + b + c - get<0>(sq[i]) - get<2>(sq[i]);
    get<3>(sq[i]) = i;
    if (get<0>(sq[i]) > mx) {
      mx = get<0>(sq[i]);
      ind1 = i;
    }
  }
  sort(sq, sq + n);
  for (int i = 1; i < n; i++) {
    int x, y, z;
    int q, w, e;
    x = get<0>(sq[i]);
    y = get<1>(sq[i]);
    z = get<2>(sq[i]);
    q = get<0>(sq[i - 1]);
    w = get<1>(sq[i - 1]);
    e = get<2>(sq[i - 1]);
    if ((x == q) && (y == w)) {
      int d = z + e;
      if (min(d, min(x, y)) > mx) {
        mx = min(d, min(x, y));
        ind1 = get<3>(sq[i]);
        ind2 = get<3>(sq[i - 1]);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    swap(get<0>(sq[i]), get<2>(sq[i]));
  }
  sort(sq, sq + n);
  for (int i = 1; i < n; i++) {
    int x, y, z;
    int q, w, e;
    x = get<0>(sq[i]);
    y = get<1>(sq[i]);
    z = get<2>(sq[i]);
    q = get<0>(sq[i - 1]);
    w = get<1>(sq[i - 1]);
    e = get<2>(sq[i - 1]);
    if ((x == q) && (y == w)) {
      int d = z + e;
      if (min(d, min(x, y)) > mx) {
        mx = min(d, min(x, y));
        ind1 = get<3>(sq[i]);
        ind2 = get<3>(sq[i - 1]);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    swap(get<1>(sq[i]), get<2>(sq[i]));
  }
  sort(sq, sq + n);
  for (int i = 1; i < n; i++) {
    int x, y, z;
    int q, w, e;
    x = get<0>(sq[i]);
    y = get<1>(sq[i]);
    z = get<2>(sq[i]);
    q = get<0>(sq[i - 1]);
    w = get<1>(sq[i - 1]);
    e = get<2>(sq[i - 1]);
    if ((x == q) && (y == w)) {
      int d = z + e;
      if (min(d, min(x, y)) > mx) {
        mx = min(d, min(x, y));
        ind1 = get<3>(sq[i]);
        ind2 = get<3>(sq[i - 1]);
      }
    }
  }
  if (ind2 == -1) {
    cout << 1 << "\n";
    cout << ind1 + 1;
  } else {
    cout << 2 << "\n";
    cout << ind1 + 1 << " " << ind2 + 1;
  }
}
