#include <bits/stdc++.h>
using namespace std;
int ni() {
  int val;
  scanf("%i", &val);
  return val;
}
struct Stone {
  Stone(int a, int b, int c, int tid) {
    vector<int> sd(3);
    sd[0] = a, sd[1] = b, sd[2] = c;
    sort(sd.begin(), sd.end());
    sides = make_tuple(sd[0], sd[1], sd[2]);
    id = tid;
  }
  tuple<int, int, int> sides;
  int id;
};
map<pair<int, int>, pair<int, int>> best;
void include_stone(const vector<int>& stone) {
  set<int64_t> inserted;
  for (int j = 0; j < 3; ++j)
    for (int k = j + 1; k < 3; ++k) {
      int rem_side = 0;
      for (int i = 0; i < 3; ++i)
        if (i != j && i != k) rem_side = stone[i];
      auto key = make_pair(max(stone[k], stone[j]), min(stone[k], stone[j]));
      int64_t hs = key.first * 11LL + key.second * 101LL + rem_side * 1000013LL;
      if (0 == inserted.count(hs)) {
        auto it = best.find(key);
        if (it == best.end()) {
          it = best.emplace(make_pair(key, make_pair(rem_side, 0))).first;
        } else {
          if (rem_side >= it->second.first) {
            it->second.second = it->second.first;
            it->second.first = rem_side;
          } else if (rem_side >= it->second.second)
            it->second.second = rem_side;
        }
        inserted.emplace(hs);
      }
    }
}
int get_r(const pair<int, int>& key, const pair<int, int>& sides) {
  return min(key.first, min(key.second, sides.first + sides.second));
}
int main() {
  int n = ni();
  vector<Stone> stones;
  stones.reserve(n);
  {
    for (int i = 0; i < n; ++i) {
      int a = ni(), b = ni(), c = ni();
      stones.emplace_back(Stone{a, b, c, i + 1});
      include_stone(vector<int>{a, b, c});
    }
  }
  int max_r = 0;
  pair<int, int> ans_sides;
  for (const auto& node : best) {
    auto r = get_r(node.first, node.second);
    if (r > max_r) {
      max_r = r;
      ans_sides = node.first;
    }
  }
  vector<Stone> ref_stones;
  auto rem_sides = best[ans_sides];
  ref_stones.emplace_back(
      Stone{ans_sides.first, ans_sides.second, rem_sides.first, 0});
  if (rem_sides.second)
    ref_stones.emplace_back(
        Stone{ans_sides.first, ans_sides.second, rem_sides.second, 0});
  for (int r = 0; r < ref_stones.size(); ++r)
    for (int i = 0; i < n; ++i) {
      if (ref_stones[r].sides == stones[i].sides) {
        ref_stones[r].id = stones[i].id;
        stones[i].sides = make_tuple(0, 0, 0);
        break;
      }
    }
  printf("%i\n", ref_stones.size());
  for (int i = 0; i < ref_stones.size(); ++i) printf("%i ", ref_stones[i].id);
  return 0;
}
