#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, vector<pair<int, int>>> mp;
vector<int> ans;
int main() {
  int l, w, h, maxx = 0, idx;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &l);
    scanf("%d", &w);
    scanf("%d", &h);
    if (l != w && h != w && l != h) {
      mp[{min(l, w), max(l, w)}].push_back({h, i});
      mp[{min(l, h), max(l, h)}].push_back({w, i});
      mp[{min(h, w), max(h, w)}].push_back({l, i});
    } else if (l == w && w == h) {
      mp[{min(l, w), max(l, w)}].push_back({h, i});
    } else if (l == w || l == h || w == h) {
      mp[{min(l, w), max(l, w)}].push_back({h, i});
      mp[{min(h, w), max(h, w)}].push_back({l, i});
    }
  }
  for (auto &it : mp) {
    auto &temp = it.second;
    sort(temp.rbegin(), temp.rend());
    int a = temp[0].first;
    if (temp.size() > 1) a += temp[1].first;
    int anss = min(a, min(it.first.first, it.first.second));
    if (anss > maxx) {
      ans.clear();
      maxx = anss;
      ans.push_back(temp[0].second + 1);
      if (temp.size() > 1) ans.push_back(temp[1].second + 1);
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); ++i) {
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}
