#include <bits/stdc++.h>
using namespace std;
const int N = 100111;
pair<long long, pair<long long, long long> > z[4 * N];
long long a[N], b[N], c[N], m = 0, n, mm, m1, m2, ans = -1, xx1, xx2, yy1, yy2,
                            zz1, zz2;
void sw(long long x) {
  long long mx, mn, sum;
  sum = a[x] + b[x] + c[x];
  mx = max(a[x], max(b[x], c[x]));
  mn = min(a[x], min(b[x], c[x]));
  a[x] = mn;
  b[x] = sum - mx - mn;
  c[x] = mx;
}
void sw1() {
  long long mx, mn, sum;
  sum = xx1 + yy1 + zz1;
  mx = max(xx1, max(yy1, zz1));
  mn = min(xx1, min(yy1, zz1));
  xx1 = mn;
  yy1 = sum - mx - mn;
  zz1 = mx;
}
void sw2() {
  long long mx, mn, sum;
  sum = xx2 + yy2 + zz2;
  mx = max(xx2, max(yy2, zz2));
  mn = min(xx2, min(yy2, zz2));
  xx2 = mn;
  yy2 = sum - mx - mn;
  zz2 = mx;
}
long long com(long long x) {
  long long x1, x2, p1, p2;
  x1 = z[x].second.second;
  x2 = z[x - 1].second.second;
  return min(z[x].first, min(z[x].second.first, x1 + x2));
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    sw(i);
    z[m].first = a[i];
    z[m].second.first = b[i];
    z[m].second.second = c[i];
    if (b[i] != z[m].first || c[i] != z[m].second.first) {
      m++;
      z[m].first = b[i];
      z[m].second.first = c[i];
      z[m].second.second = a[i];
      if ((a[i] != z[m].first || c[i] != z[m].second.first) &&
          (a[i] != z[m - 1].first || c[i] != z[m - 1].second.first)) {
        m++;
        z[m].first = a[i];
        z[m].second.first = c[i];
        z[m].second.second = b[i];
      }
    } else if (a[i] != z[m].first || c[i] != z[m].second.first) {
      m++;
      z[m].first = a[i];
      z[m].second.first = c[i];
      z[m].second.second = b[i];
    }
    m++;
  }
  sort(z, z + m);
  long long xx, yy, zz, k;
  xx = z[0].first;
  yy = z[0].second.first;
  zz = z[0].second.second;
  k = 1;
  z[m].first = -1;
  z[m].second.first = -1;
  z[m].second.second = -1;
  m++;
  for (int i = 1; i < m; i++) {
    if (xx == z[i].first && yy == z[i].second.first)
      k++;
    else {
      k = 1;
      xx = z[i].first;
      yy = z[i].second.first;
      continue;
    }
    if (xx != z[i + 1].first || yy != z[i + 1].second.first) {
      if (k > 1) {
        long long p = com(i);
        if (ans < p) {
          ans = p;
          xx1 = z[i].first;
          yy1 = z[i].second.first;
          zz1 = z[i].second.second;
          xx2 = z[i - 1].first;
          yy2 = z[i - 1].second.first;
          zz2 = z[i - 1].second.second;
          mm = 2;
        }
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (ans < min(a[i], min(b[i], c[i]))) {
      ans = min(a[i], min(b[i], c[i]));
      mm = 1;
      m1 = i;
    }
  if (mm == 1) {
    cout << 1 << "\n";
    cout << m1 + 1;
  }
  if (mm == 2) {
    sw1();
    sw2();
    m1 = m2 = 0;
    cout << 2 << "\n";
    for (int i = 0; i < n; i++) {
      if (a[i] == xx1 && b[i] == yy1 && c[i] == zz1) {
        m1 = i;
        cout << i + 1 << "\n";
        break;
      }
    }
    for (int i = 0; i < n; i++) {
      if (a[i] == xx2 && b[i] == yy2 && c[i] == zz2 && i != m1) {
        cout << i + 1 << "\n";
        break;
      }
    }
  }
}
