#include <bits/stdc++.h>
using namespace std;
struct Node {
  int a, b, c, idx;
} sa[100100], sb[100100], sc[100100];
bool cmp1(Node n1, Node n2) {
  if (n1.a != n2.a) return n1.a < n2.a;
  if (n1.b != n2.b) return n1.b < n2.b;
  return n1.c < n2.c;
}
bool cmp2(Node n1, Node n2) {
  if (n1.a != n2.a) return n1.a < n2.a;
  if (n1.c != n2.c) return n1.c < n2.c;
  return n1.b < n2.b;
}
bool cmp3(Node n1, Node n2) {
  if (n1.b != n2.b) return n1.b < n2.b;
  if (n1.c != n2.c) return n1.c < n2.c;
  return n1.a < n2.a;
}
int ans[2];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; ++i) {
      scanf("%d %d %d", &sa[i].a, &sa[i].b, &sa[i].c);
      if (sa[i].a > sa[i].b) swap(sa[i].a, sa[i].b);
      if (sa[i].b > sa[i].c) swap(sa[i].b, sa[i].c);
      if (sa[i].a > sa[i].b) swap(sa[i].a, sa[i].b);
      sb[i].a = sc[i].a = sa[i].a;
      sb[i].b = sc[i].b = sa[i].b;
      sb[i].c = sc[i].c = sa[i].c;
      sa[i].idx = sb[i].idx = sc[i].idx = i;
    }
    sort(sa + 1, sa + 1 + n, cmp1);
    sort(sb + 1, sb + 1 + n, cmp2);
    sort(sc + 1, sc + 1 + n, cmp3);
    int flg = 1, maxn = -1;
    for (int i = 1; i <= n; ++i) {
      int tmp = min(sa[i].a, min(sa[i].b, sa[i].c));
      if (maxn < tmp) {
        ans[0] = sa[i].idx;
        maxn = tmp;
      }
    }
    for (int i = 1; i <= n; ++i) {
      if (sa[i].b < maxn || sa[i].c < maxn) continue;
      int l = 1, r = n, mid;
      while (l <= r) {
        mid = (l + r) >> 1;
        if (sa[mid].a > sa[i].b)
          r = mid - 1;
        else {
          if (sa[mid].a < sa[i].b)
            l = mid + 1;
          else {
            if (sa[mid].b > sa[i].c)
              r = mid - 1;
            else
              l = mid + 1;
          }
        }
      }
      if (sa[r].idx == sa[i].idx) r--;
      if (sa[r].a == sa[i].b && sa[r].b == sa[i].c) {
        int tmp = min(sa[r].c + sa[i].a, min(sa[i].b, sa[i].c));
        if (maxn < tmp) {
          flg = 2;
          ans[0] = sa[i].idx;
          ans[1] = sa[r].idx;
          maxn = tmp;
        }
      }
      l = 1;
      r = n;
      while (l <= r) {
        mid = (l + r) >> 1;
        if (sb[mid].a > sa[i].b)
          r = mid - 1;
        else {
          if (sb[mid].a < sa[i].b)
            l = mid + 1;
          else {
            if (sb[mid].c > sa[i].c)
              r = mid - 1;
            else
              l = mid + 1;
          }
        }
      }
      if (sb[r].idx == sa[i].idx) r--;
      if (sb[r].a == sa[i].b && sb[r].c == sa[i].c) {
        int tmp = min(sb[r].b + sa[i].a, min(sa[i].b, sa[i].c));
        if (maxn < tmp) {
          flg = 2;
          ans[0] = sa[i].idx;
          ans[1] = sb[r].idx;
          maxn = tmp;
        }
      }
      l = 1;
      r = n;
      while (l <= r) {
        mid = (l + r) >> 1;
        if (sc[mid].b > sa[i].b)
          r = mid - 1;
        else {
          if (sc[mid].b < sa[i].b)
            l = mid + 1;
          else {
            if (sc[mid].c > sa[i].c)
              r = mid - 1;
            else
              l = mid + 1;
          }
        }
      }
      if (sc[r].idx == sa[i].idx) r--;
      if (sc[r].b == sa[i].b && sc[r].c == sa[i].c) {
        int tmp = min(sc[r].a + sa[i].a, min(sa[i].b, sa[i].c));
        if (maxn < tmp) {
          flg = 2;
          ans[0] = sa[i].idx;
          ans[1] = sc[r].idx;
          maxn = tmp;
        }
      }
    }
    printf("%d\n%d", flg, ans[0]);
    for (int i = 1; i < flg; ++i) printf(" %d", ans[i]);
    cout << endl;
  }
}
