#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  map<pair<int, int>, vector<pair<int, int>>> tmp;
  int n;
  cin >> n;
  vector<tuple<int, int, int>> rect;
  for (int i = 0; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    if (a > b) {
      swap(a, b);
    }
    if (b > c) {
      swap(b, c);
    }
    if (a > b) {
      swap(a, b);
    }
    cerr << a << ' ' << b << ' ' << c << '\n';
    if (a == c) {
      tmp[{a, c}].push_back({c, i});
    } else if (a == b) {
      tmp[{a, b}].push_back({c, i});
      tmp[{a, c}].push_back({b, i});
    } else if (b == c) {
      tmp[{b, c}].push_back({a, i});
      tmp[{a, b}].push_back({c, i});
    } else {
      tmp[{b, c}].push_back({a, i});
      tmp[{a, b}].push_back({c, i});
      tmp[{a, c}].push_back({b, i});
    }
    rect.push_back({a, b, c});
  }
  for (auto &t : tmp) {
    sort(t.second.rbegin(), t.second.rend());
  }
  int best = 0;
  pair<int, int> ans = {-1, -1};
  int pos = 0;
  for (auto [a, b, c] : rect) {
    if (a > best) {
      best = a;
      ans = {pos, -1};
    }
    pos++;
  }
  pos = 0;
  for (auto [a, b, c] : rect) {
    int cur = 0;
    int ind = -1;
    if (tmp[{a, c}].size() > 1) {
      if (tmp[{a, c}][0].second == pos) {
        if (cur < min({tmp[{a, c}][1].first + b, a, c})) {
          cur = min({tmp[{a, c}][1].first + b, a, c});
          ind = tmp[{a, c}][1].second;
        }
      } else {
        if (cur < min({tmp[{a, c}][0].first + b, a, c})) {
          cur = min({tmp[{a, c}][0].first + b, a, c});
          ind = tmp[{a, c}][0].second;
        }
      }
    }
    if (tmp[{a, b}].size() > 1) {
      if (tmp[{a, b}][0].second == pos) {
        if (cur < min({tmp[{a, b}][1].first + c, a, b})) {
          cur = min({tmp[{a, b}][1].first + c, a, b});
          ind = tmp[{a, b}][1].second;
        }
      } else {
        if (cur < min({tmp[{a, b}][0].first + c, a, b})) {
          cur = min({tmp[{a, b}][0].first + c, a, b});
          ind = tmp[{a, b}][0].second;
        }
      }
    }
    if (tmp[{b, c}].size() > 1) {
      if (tmp[{b, c}][0].second == pos) {
        if (cur < min({tmp[{b, c}][1].first + a, b, c})) {
          cur = min({tmp[{b, c}][1].first + a, b, c});
          ind = tmp[{b, c}][1].second;
        }
      } else {
        if (cur < min({tmp[{b, c}][0].first + a, b, c})) {
          cur = min({tmp[{b, c}][0].first + a, b, c});
          ind = tmp[{b, c}][0].second;
        }
      }
    }
    if (cur > best) {
      best = cur;
      ans = {pos, ind};
    }
    pos++;
  }
  if (ans.second == -1) {
    cout << 1 << '\n';
    cout << ans.first + 1 << '\n';
  } else {
    cout << 2 << '\n';
    cout << ans.first + 1 << ' ' << ans.second + 1 << '\n';
  }
}
