#include <bits/stdc++.h>
using namespace std;
map<int, map<int, priority_queue<pair<int, int> > > > maap;
map<int, map<int, int> > sz;
vector<int> ans;
long long mxd;
void cek(int a, int b, int c, int id) {
  if (sz[a][b] == 0) {
    maap[a][b].push(make_pair(-c, id));
    sz[a][b]++;
    if ((long long)min(a, min(b, c)) > mxd) {
      mxd = (long long)min(a, min(b, c));
      ans.clear();
      ans.push_back(id);
    }
  } else {
    maap[a][b].push(make_pair(-c, id));
    sz[a][b]++;
    if (sz[a][b] > 2) {
      maap[a][b].pop();
      sz[a][b]--;
    }
    long long mn = (long long)min(a, b);
    pair<int, int> tmp = maap[a][b].top();
    maap[a][b].pop();
    mn = min(mn, -((long long)tmp.first + (long long)maap[a][b].top().first));
    if (mn > mxd) {
      mxd = mn;
      ans.clear();
      ans.push_back(tmp.second);
      ans.push_back(maap[a][b].top().second);
    }
    maap[a][b].push(tmp);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  mxd = 0ll;
  for (int i = 1; i <= n; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a == b && b == c)
      cek(a, b, c, i);
    else if (a == b || b == c) {
      cek(min(a, b), max(a, b), c, i);
      cek(min(b, c), max(b, c), a, i);
    } else if (a == c) {
      cek(min(a, b), max(a, b), c, i);
      cek(min(a, c), max(a, c), b, i);
    } else {
      cek(min(a, b), max(a, b), c, i);
      cek(min(b, c), max(b, c), a, i);
      cek(min(a, c), max(a, c), b, i);
    }
  }
  int len = ans.size();
  printf("%d\n", len);
  for (int i = 0; i < len; i++) {
    printf("%d", ans[i]);
    if (i + 1 < len)
      printf(" ");
    else
      printf("\n");
  }
  return 0;
}
