#include <bits/stdc++.h>
using namespace std;
// #define ll  long long
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll  long  long
#define rep(i, e, n) for (ll i = e; i < n; i++)
#define for_t int t;cin>>t;while(t--)
ll M =1e9+7;
const int mx=3e5 ;
ll a[mx] ,vis[mx];
int n,m,k;
// vector< int> gf[mx],rgf[mx];
stack <int >stk;

int main() {
    cin>>n;
    a[0]=INT_MIN;
    rep(i,1,n+1)cin>>a[i];
   a[n+1]=INT_MAX;
   vector<int> vi;
   rep(i,1,n+1){
       if(a[i]<a[i-1])vi.pb(i);
       //cout<< a[i];
   }
   //rep(i,0,n+2)cout<<a[i]<< " ";

   if(vi.size()==0) { cout<<"YES";return 0;}

        int tmp =vi[0];
        int tmp2=vi.back();

        swap(a[tmp-1],a[tmp2] );

      rep(i,0,n+1)if(a[i]>a[i+1]){
      cout<<"NO";return 0;
      }
     cout<<"Yes";return 0;
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;

#define ll long long int
#define ld long double
#define MAX 500007
#define MOD 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main(){

    fast;

    ll n,i;
    cin >> n;
    ll a[n];

    for(i=0;i<n;i++){
        cin >> a[i];
    }

    ll k1 = -1;
    ll k2 = n-1;

    for(i=0;i<n-1;i++){
        if(a[i]>a[i+1]){
            k1 = i;
            break;
        }
    }

    int ch = 1;

    for(i=k1;i<n;i++){
        if(a[i]>a[k1]){
            k2 = i;
            ch = 0;
            break;
        }
    }

    if(k1!=-1){
        if(ch){
            swap(a[k1],a[k2]);
        }
        else{
            swap(a[k1],a[k2-1]);
        }
    }

    int flg = 1;

    for(i=0;i<n-1;i++){
        if(a[i]>a[i+1]){
            flg = 0;
            break;
        }
    }

    if(flg==1){
        cout << "YES\n";
    }
    else{
        cout << "NO\n";
    }

}

/*7*/

//    cout << fixed << setprecision(2);


#include <iostream>
#include <bits/stdc++.h>

using namespace std;

#define ll long long int
#define ld long double
#define MAX 500007
#define MOD 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main(){

    fast;

    ll n,i;
    cin >> n;
    ll a[n];

    for(i=0;i<n;i++){
        cin >> a[i];
    }

    ll g = -1;
    ll s = -1;

    for(i=0;i<n-1;i++){
        if(a[i]>a[i+1]){
            g = i;
            s = i+1;
        }
    }

    if(g==-1){
        cout << "YES\n";
    }
    else{

        int flg = 2;

        ll k1 = n;
        for(i=g+1;i<n;i++){
            if(a[i]>=a[g]){
                k1 = i;
                break;
            }
        }
        k1--;

        swap(a[g],a[k1]);

        for(i=0;i<n-1;i++){
            if(a[i]>a[i+1]){
                flg--;
                break;
            }
        }

        swap(a[g],a[k1]);

        k1 = -1;
        for(i=s-1;i>=0;i--){
            if(a[i]<=a[s]){
                k1 = i;
                break;
            }
        }
        k1++;

        swap(a[s],a[k1]);

        for(i=0;i<n-1;i++){
            if(a[i]>a[i+1]){
                flg--;
                break;
            }
        }

        if(flg){
            cout << "YES\n";
        }
        else{
            cout << "NO\n";
        }

    }

}

/*7*/

//    cout << fixed << setprecision(2);


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

// Use g++ compiler for this include to work.
#include <bits/stdc++.h>

using namespace std;

// Constants
#define INF 1e18
#define EPS 1e-9
#define MOD 1000000007

// // for using in pairs
#define F first
#define S second

// Macros
#define all(x) begin(x), end(x)

// aliases
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;

// Temporary macro.
#define int long long

// Operator overloads.
/**
 * The type of element in the vector should have overload for << operator with ostream.
 */
template<typename T>
ostream& operator<<(ostream &stream, vector<T>& v)
{
	for (const auto &it : v)
		stream << it << " ";
	return stream;
}

/**
 * Both types in the pair should have overload for << operator with ostream.
 */
template<typename T1, typename T2>
ostream& operator<<(ostream &ostream, pair<T1, T2>& p)
{
	ostream << p.first << " " << p.second;
	return ostream;
}

template<typename T1, typename T2>
istream& operator>>(istream &istream, pair<T1, T2>& p)
{
	istream >> p.first >> p.second;
	return istream;
}

template<typename T>
istream& operator>>(istream &istream, vector<T>& a)
{
	for (auto &it : a)
		istream >> it;
	return istream;
}

// Utility functions.

int GCD(int a, int b)
{
	if (!b)
		return a;
	return GCD(b, a % b);
}

int LCM(int a, int b)
{
	return (a * b) / GCD(a, b);
}

int modpow(int x, int n, int m = MOD)
{
	if (n == 0) return 1 % m;
	long long u = modpow(x, n / 2, m);
	u = (u * u) % m;
	if (n % 2 == 1)
		u = (u * x) % m;
	return u;
}

//////////////////// START CODE HERE ///////////////////////////

void solve(int tc)
{
	int n;
	cin >> n;
	vector<vector<int>> a(n, vector<int>(4));

	for (int i = 0; i < n; i++)
	{
		cin >> a[i][0] >> a[i][1] >> a[i][2];
		a[i][3] = i + 1;
		sort(a[i].begin(), a[i].end() - 1, greater<int>());
	}

	sort(all(a), [](auto& x, auto &y)
	{
		if (x[0] == y[0] && x[1] == y[1])
			return x[2] < y[2];
		if (x[0] == y[0])
			return x[1] < y[1];
		return x[0] < y[0];
	});

	reverse(all(a));
	// for (auto &it : a)
	// 	cout << it << "\n";

	int p = a[0][3], q = 0;
	int maxD = a[0][2];

	for (int i = 0; i < n; i++)
	{
		if (a[i][2] > maxD)
		{
			maxD = a[i][2];
			p = a[i][3];
		}
	}

	// cout << maxD << "\n";

	for (int i = 0; i < n - 1; i++)
	{
		auto &x = a[i];
		auto &y = a[i + 1];

		int currD = 0;
		int m = min(x[0], x[1]);

		if (x[0] == y[0] && x[1] == y[1])
			currD = max(currD, min(m, x[2] + y[2]));

		if (x[0] == y[0] && x[1] == y[2])
			currD = max(currD, min(m, x[2] + y[1]));

		if (x[0] == y[1] && x[1] == y[2])
			currD = max(currD, min(m, x[2] + y[0]));

		m = min(x[1], x[2]);
		if (x[1] == y[0] && x[2] == y[1])
			currD = max(currD, min(m, x[0] + y[2]));

		if (x[1] == y[0] && x[2] == y[2])
			currD = max(currD, min(m, x[0] + y[1]));

		if (x[1] == y[1] && x[2] == y[2])
			currD = max(currD, min(m, x[0] + y[0]));

		m = min(x[0], x[2]);
		if (x[0] == y[0] && x[2] == y[1])
			currD = max(currD, min(m, x[1] + y[2]));

		if (x[0] == y[0] && x[2] == y[2])
			currD = max(currD, min(m, x[1] + y[1]));

		if (x[0] == y[1] && x[2] == y[2])
			currD = max(currD, min(m, x[1] + y[0]));

		// cout << currD << "\n";
		if (currD > maxD)
		{
			p = x[3];
			q = y[3];
			maxD = currD;
		}
	}
	if (q)
	{
		cout << "2\n";
		cout << p << " " << q << "\n";
	}else
	{
		cout << "1\n" << p << "\n";
	}
}

int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t = 1;
	// cin >> t;
	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}

	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

// Use g++ compiler for this include to work.
#include <bits/stdc++.h>

using namespace std;

// Constants
#define INF 1e18
#define EPS 1e-9
#define MOD 1000000007

// // for using in pairs
#define F first
#define S second

// Macros
#define all(x) begin(x), end(x)

// aliases
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;

// Temporary macro.
#define int long long

// Operator overloads.
/**
 * The type of element in the vector should have overload for << operator with ostream.
 */
template<typename T>
ostream& operator<<(ostream &stream, vector<T>& v)
{
	for (const auto &it : v)
		stream << it << " ";
	return stream;
}

/**
 * Both types in the pair should have overload for << operator with ostream.
 */
template<typename T1, typename T2>
ostream& operator<<(ostream &ostream, pair<T1, T2>& p)
{
	ostream << p.first << " " << p.second;
	return ostream;
}

template<typename T1, typename T2>
istream& operator>>(istream &istream, pair<T1, T2>& p)
{
	istream >> p.first >> p.second;
	return istream;
}

template<typename T>
istream& operator>>(istream &istream, vector<T>& a)
{
	for (auto &it : a)
		istream >> it;
	return istream;
}

// Utility functions.

int GCD(int a, int b)
{
	if (!b)
		return a;
	return GCD(b, a % b);
}

int LCM(int a, int b)
{
	return (a * b) / GCD(a, b);
}

int modpow(int x, int n, int m = MOD)
{
	if (n == 0) return 1 % m;
	long long u = modpow(x, n / 2, m);
	u = (u * u) % m;
	if (n % 2 == 1)
		u = (u * x) % m;
	return u;
}

//////////////////// START CODE HERE ///////////////////////////

void solve(int tc)
{
	int n;
	cin >> n;
	vector<vector<int>> a(n, vector<int>(4));

	for (int i = 0; i < n; i++)
	{
		cin >> a[i][0] >> a[i][1] >> a[i][2];
		a[i][3] = i + 1;
		sort(a[i].begin(), a[i].end() - 1, greater<int>());
	}

	sort(all(a), [](auto& x, auto &y)
	{
		if (x[0] == y[0] && x[1] == y[1])
			return x[2] < y[2];
		if (x[0] == y[0])
			return x[1] < y[1];
		return x[0] < y[0];
	});

	reverse(all(a));
	// for (auto &it : a)
	// 	cout << it << "\n";

	int p = a[0][3], q = 0;
	int maxD = a[0][2];

	// cout << maxD << "\n";

	for (int i = 0; i < n - 1; i++)
	{
		auto &x = a[i];
		auto &y = a[i + 1];

		int currD = 0;
		int m = min(x[0], x[1]);

		if (x[0] == y[0] && x[1] == y[1])
			currD = max(currD, min(m, x[2] + y[2]));

		if (x[0] == y[0] && x[1] == y[2])
			currD = max(currD, min(m, x[2] + y[1]));

		if (x[0] == y[1] && x[1] == y[2])
			currD = max(currD, min(m, x[2] + y[0]));

		m = min(x[1], x[2]);
		if (x[1] == y[0] && x[2] == y[1])
			currD = max(currD, min(m, x[0] + y[2]));

		if (x[1] == y[0] && x[2] == y[2])
			currD = max(currD, min(m, x[0] + y[1]));

		if (x[1] == y[1] && x[2] == y[2])
			currD = max(currD, min(m, x[0] + y[0]));

		m = min(x[0], x[2]);
		if (x[0] == y[0] && x[2] == y[1])
			currD = max(currD, min(m, x[1] + y[2]));

		if (x[0] == y[0] && x[2] == y[2])
			currD = max(currD, min(m, x[1] + y[1]));

		if (x[0] == y[1] && x[2] == y[2])
			currD = max(currD, min(m, x[1] + y[0]));

		// cout << currD << "\n";
		if (currD > maxD)
		{
			p = x[3];
			q = y[3];
			maxD = currD;
		}
	}
	if (q)
	{
		cout << "2\n";
		cout << p << " " << q << "\n";
	}else
	{
		cout << "1\n" << p << "\n";
	}
}

int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t = 1;
	// cin >> t;
	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define float double
#define f first
#define s second
signed main()
{
    int n,i,j,y=0,z=INT_MIN;
    cin>>n;
    vector<int> a;
    map<pair<int,int>,vector<pair<int,int>>> m;
    for(j=1;j<=n;j++)
    {
        int v[3];
        for(i=0;i<3;i++)
        cin>>v[i];
        sort(v,v+3);
        do
        {
            pair<int,int> p1,p2;
            p1={v[0],v[1]};
            p2={v[1],v[0]};
            if((m.find(p1)==m.end())&&(m.find(p2)==m.end()))
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p2].push_back({v[2],j});
        }while (next_permutation(v,v+3));
    }
    for(auto e:m)
    {
        int b=(e.f.s),x=(e.f.f),d=0;b*=x;
        vector<pair<int,int>> c(e.s);
        sort(c.begin(),c.end());int f=c.size();
        for(i=max(0*1LL,f-2);i<c.size();i++)
        d+=c[i].s;
        b*=d;
        if(b>z)
        {
            a.clear();
            for(i=max(0*1LL,f-2);i<c.size();i++)
            {a.push_back(c[i].s);}
            z=c.size();
        }
    }
    cout<<min(2*1LL,z)<<endl;
    for(i=0;i<a.size();i++)
    cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define float double
#define f first
#define s second
signed main()
{
    int n,i,j,y=0,z=INT_MIN;
    cin>>n;
    vector<int> a;
    map<pair<int,int>,vector<pair<int,int>>> m;
    for(j=1;j<=n;j++)
    {
        int v[3];
        for(i=0;i<3;i++)
        cin>>v[i];
        sort(v,v+3);
        do
        {
            pair<int,int> p1,p2;
            p1={v[0],v[1]};
            p2={v[1],v[0]};
            if((m.find(p1)==m.end())&&(m.find(p2)==m.end()))
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p2].push_back({v[2],j});
        }while (next_permutation(v,v+3));
    }
    for(auto e:m)
    {
        int b=(e.f.s),x=(e.f.f),d=0;b*=x;
        vector<pair<int,int>> c(e.s);
        sort(c.begin(),c.end());int f=c.size();
        for(i=max(0*1LL,f-2);i<c.size();i++)
        d+=c[i].f;
        b*=d;
        if(b>z)
        {
            a.clear();
            for(i=max(0*1LL,f-2);i<c.size();i++)
            {a.push_back(c[i].s);}
            z=c.size();
        }
    }
    cout<<min(2*1LL,z)<<endl;
    for(i=0;i<a.size();i++)
    cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
int main(){
  int n,a,b,k,x,h,mx=0;cin>>n;
  vector<int>v(3);
  map<pii,pii>mp;
  for(int i=0;i<n;i++){
    cin>>v[0]>>v[1]>>v[2];
    sort(v.begin(), v.end());
    if(v[0]>mx){k=1; mx=v[0]; a=i; }
    do{
      pii p={v[0],v[1]};
      if(mp.find(p)==mp.end()) mp[p]={v[2],i};
      else {
        x=mp[p].first;
        h=min(min(v[0],v[1]),x+v[2]);
        if(h>mx)mx=h,a=mp[p].second,b=i,k=2;
        if(x<v[2])mp[p]={v[2],i};
      }
    }while(std::next_permutation(v.begin(), v.end()));
  }
  if(k==1)cout<<1<<'\n'<<a+1;
  else cout<<2<<'\n'<<a+1<<" "<<b+1;
}


#include <bits/stdc++.h>
using namespace std;
#define int double
#define f first
#define s second
signed main()
{
    int n,i,j,y=0,z=INT_MIN;
    cin>>n;
    vector<int> a;
    map<pair<int,int>,vector<pair<int,int>>> m;
    for(j=1;j<=n;j++)
    {
        int v[3];
        for(i=0;i<3;i++)
        cin>>v[i];
        sort(v,v+3);
        do
        {
            pair<int,int> p1,p2;
            p1={v[0],v[1]};
            p2={v[1],v[0]};
            if((m.find(p1)==m.end())&&(m.find(p2)==m.end()))
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p2].push_back({v[2],j});
        }while (next_permutation(v,v+3));
    }
    for(auto e:m)
    {
        int b=(e.f.s),x=(e.f.f),d=0;b*=x;
        vector<pair<int,int>> c(e.s);
        sort(c.begin(),c.end());int f=c.size();
        for(i=max(0*1LL,f-2);i<c.size();i++)
        d+=c[i].f;
        b*=d;
        if(b>z)
        {
            a.clear();
            for(i=max(0*1LL,f-2);i<c.size();i++)
            {a.push_back(c[i].s);}
            z=c.size();
        }
    }
    cout<<z<<endl;
    for(i=0;i<a.size();i++)
    cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define float double
#define f first
#define s second
signed main()
{
    int n,i,j,y=0,z=INT_MIN;
    cin>>n;
    vector<int> a;
    map<pair<int,int>,vector<pair<int,int>>> m;
    for(j=1;j<=n;j++)
    {
        int v[3];
        for(i=0;i<3;i++)
        cin>>v[i];
        sort(v,v+3);
        do
        {
            pair<int,int> p1,p2;
            p1={v[0],v[1]};
            p2={v[1],v[0]};
            if((m.find(p1)==m.end())&&(m.find(p2)==m.end()))
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p2].push_back({v[2],j});
        }while (next_permutation(v,v+3));
    }
    for(auto e:m)
    {
        int b=(e.f.s),x=(e.f.f),d=0;b*=x;
        vector<pair<int,int>> c(e.s);
        for(i=0;i<c.size();i++)
        d+=c[i].s;
        b*=d;
        if(b>z)
        {
            a.clear();
            for(i=0;i<c.size();i++)
            {a.push_back(c[i].s);}
            z=c.size();
        }
    }
    cout<<z<<endl;
    for(i=0;i<a.size();i++)
    cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define float double
#define f first
#define s second
signed main()
{
    int n,i,j,y=0,z=INT_MIN;
    cin>>n;
    vector<int> a;
    map<pair<int,int>,vector<pair<int,int>>> m;
    for(j=1;j<=n;j++)
    {
        int v[3];
        for(i=0;i<3;i++)
        cin>>v[i];
        sort(v,v+3);
        do
        {
            pair<int,int> p1,p2;
            p1={v[0],v[1]};
            p2={v[1],v[0]};
            if((m.find(p1)==m.end())&&(m.find(p2)==m.end()))
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p2].push_back({v[2],j});
        }while (next_permutation(v,v+3));
    }
    for(auto e:m)
    {
        int b=(e.f.s),x=(e.f.f),d=0;b*=x;
        vector<pair<int,int>> c(e.s);
        sort(c.begin(),c.end());int f=c.size();
        for(i=max(0*1LL,f-2);i<c.size();i++)
        d+=c[i].s;
        b*=d;
        if(b>z)
        {
            a.clear();
            for(i=max(0*1LL,f-2);i<c.size();i++)
            {a.push_back(c[i].s);}
            z=c.size();
        }
    }
    cout<<min(2,z)<<endl;
    for(i=0;i<a.size();i++)
    cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define float double
#define f first
#define s second
signed main()
{
    int n,i,j,y=0,z=INT_MIN;
    cin>>n;
    vector<int> a;
    map<pair<int,int>,vector<pair<int,int>>> m;
    for(j=1;j<=n;j++)
    {
        int v[3];
        for(i=0;i<3;i++)
        cin>>v[i];
        sort(v,v+3);
        do
        {
            pair<int,int> p1,p2;
            p1={v[0],v[1]};
            p2={v[1],v[0]};
            if((m.find(p1)==m.end())&&(m.find(p2)==m.end()))
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p1].push_back({v[2],j});
            else if(m.find(p1)!=m.end())
            m[p2].push_back({v[2],j});
        }while (next_permutation(v,v+3));
    }
    for(auto e:m)
    {
        int b=(e.f.s),x=(e.f.f),d=0;b*=x;
        vector<pair<int,int>> c(e.s);
        sort(c.begin(),c.end());int f=c.size();
        for(i=max(0*1LL,f-2);i<c.size();i++)
        d+=c[i].s;
        b*=d;
        if(b>z)
        {
            a.clear();
            for(i=max(0*1LL,f-2);i<c.size();i++)
            {a.push_back(c[i].s);}
            z=c.size();
        }
    }
    cout<<z<<endl;
    for(i=0;i<a.size();i++)
    cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
#define endl '\n';
typedef long long ll;

using namespace std;

ll min(ll x, ll y, ll z)
{
	return min(min(x, y), z);
}
ll max(ll x, ll y, ll z)
{
	return max(max(x, y), z);
}

ll min(ll x, ll y, ll z, ll o)
{
	return min(min(x, y, z), o);
}
const ll INF = 1e17 + 1;
const ll MAX = 2147483647;
const ll MOD = 1000003;

ll lcm(ll x, ll y)
{
	return (x * y) / __gcd(x, y);
}

int main()
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	int n;
	cin >> n;
	map<pair<ll, ll>, priority_queue<pair<ll, int>>> mp;
	for (int i = 0; i < n; i++)
	{
		ll edg[3];
		cin >> edg[0] >> edg[1] >> edg[2];
		sort(edg, edg + 3);
		mp[{edg[0], edg[1]}].push({edg[2], i});
		mp[{edg[1], edg[2]}].push({edg[0], i});
		mp[{edg[0], edg[2]}].push({edg[1], i});
	}

	ll ans = -1;
	set<int> stones;
	for (auto i : mp)
	{

		int f, s;
		ll e = i.second.top().first;
		f = i.second.top().second;
		i.second.pop();
		if (!i.second.empty())
		{
			e += i.second.top().first;
			s = i.second.top().second;
		}

		ll r = min(i.first.first, i.first.second, e);
		if (r > ans)
		{
			stones.clear();
			stones.insert(f);
			stones.insert(s);
			ans = r;
		}
	}
	// cout << ans << endl;
	cout << stones.size() << endl;
	for(auto i : stones)
		cout << i+1 <<" "  ;
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n';
typedef long long ll;

using namespace std;

ll min(ll x, ll y, ll z)
{
	return min(min(x, y), z);
}
ll max(ll x, ll y, ll z)
{
	return max(max(x, y), z);
}

ll min(ll x, ll y, ll z, ll o)
{
	return min(min(x, y, z), o);
}
const ll INF = 1e17 + 1;
const ll MAX = 2147483647;
const ll MOD = 1000003;

ll lcm(ll x, ll y)
{
	return (x * y) / __gcd(x, y);
}

int main()
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	int n;
	cin >> n;
	map<pair<ll, ll>, priority_queue<pair<ll, int>>> mp;
	for (int i = 0; i < n; i++)
	{
		ll edg[3];
		cin >> edg[0] >> edg[1] >> edg[2];
		sort(edg, edg + 3);
		mp[{edg[0], edg[1]}].push({edg[2], i});
		mp[{edg[1], edg[2]}].push({edg[0], i});
		mp[{edg[0], edg[2]}].push({edg[1], i});
	}

	ll ans = -1;
	set<int> stones;
	for (auto i : mp)
	{

		int f=-1, s=-1;
		ll e = i.second.top().first;
		f = i.second.top().second;
		i.second.pop();
		if (!i.second.empty())
		{
			e += i.second.top().first;
			s = i.second.top().second;
		}

		ll r = min(i.first.first, i.first.second, e);
		if (r > ans)
		{
			stones.clear();
			stones.insert(f);
			if(s >= 0)
				stones.insert(s);
			ans = r;
		}
	}
	// cout << ans << endl;
	cout << stones.size() << endl;
	for(auto i : stones)
		cout << i+1 <<" "  ;
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n';
typedef long long ll;

using namespace std;

ll min(ll x, ll y, ll z)
{
	return min(min(x, y), z);
}
ll max(ll x, ll y, ll z)
{
	return max(max(x, y), z);
}

ll min(ll x, ll y, ll z, ll o)
{
	return min(min(x, y, z), o);
}
const ll INF = 1e17 + 1;
const ll MAX = 2147483647;
const ll MOD = 1000003;

ll lcm(ll x, ll y)
{
	return (x * y) / __gcd(x, y);
}

int main()
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	int n;
	cin >> n;
	map<pair<ll, ll>, priority_queue<pair<ll, int>>> mp;
	for (int i = 0; i < n; i++)
	{
		ll edg[3];
		cin >> edg[0] >> edg[1] >> edg[2];
		sort(edg, edg + 3);
		mp[{edg[0], edg[1]}].push({edg[2], i});
		mp[{edg[1], edg[2]}].push({edg[0], i});
		mp[{edg[0], edg[2]}].push({edg[1], i});
	}

	ll ans = -1;
	set<int> stones;
	for (auto i : mp)
	{

		int f=-1, s=-1;
		ll e = i.second.top().first;
		f = i.second.top().second;
		i.second.pop();
		if (!i.second.empty())
		{
			e += i.second.top().first;
			s = i.second.top().second;
		}

		ll r = min(i.first.first, i.first.second, e);
		if (r > ans)
		{
			stones.clear();
			stones.insert(f);
			if(s > 0)
				stones.insert(s);
			ans = r;
		}
	}
	// cout << ans << endl;
	cout << stones.size() << endl;
	for(auto i : stones)
		cout << i+1 <<" "  ;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define eb emplace_back
#define For(i,n) for(int i=0;i<(n);i++)
#define init(a) memset((a),0,sizeof(a));
int n,a,b,c,ans,k,x,y;
int32_t main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	map<pii,pii>mp;
	For(i,n){
		cin>>a>>b>>c;
		if(a>b)swap(a,b);
		if(b>c)swap(b,c);
		if(a>b)swap(a,b);
		if(a>ans){
			ans=a;
			k=1;
			x=i;
		}
		if(mp.find({b,c})!=mp.end() && min(mp[{b,c}].F+a,min(b,c))>ans){
			ans=min(mp[{b,c}].F+a,min(b,c));
			k=2;
			x = mp[{b,c}].S;
			y = i;
		}
		mp[{a,b}]=max(mp[{a,b}],{c,i});
		mp[{b,c}]=max(mp[{b,c}],{a,i});
		mp[{a,c}]=max(mp[{a,c}],{b,i});
	}
	if(k==1)cout<<k<<endl<<x+1<<endl;
	else cout<<k<<endl<<x+1<<" "<<y+1<<endl;
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define eb emplace_back
#define For(i,n) for(int i=0;i<(n);i++)
#define init(a) memset((a),0,sizeof(a));
int n,a,b,c,ans,k,x,y;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	map<pii,pii>mp;
	For(i,n){
		cin>>a>>b>>c;
		if(a>b)swap(a,b);
		if(b>c)swap(b,c);
		if(a>b)swap(a,b);
		if(a>ans){
			ans=a;
			k=1;
			x=i;
		}
		if(mp.find({b,c})!=mp.end() && min(mp[{b,c}].F+a,min(b,c))>ans){
			ans=min(mp[{b,c}].F+a,min(b,c));
			k=2;
			x = mp[{b,c}].S;
			y = i;
		}
		mp[{a,b}]={c,i};
		mp[{b,c}]={a,i};
		mp[{a,c}]={b,i};
	}
	if(k==1)cout<<k<<endl<<x+1<<endl;
	else cout<<k<<endl<<x+1<<" "<<y+1<<endl;
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define eb emplace_back
#define For(i,n) for(int i=0;i<(n);i++)
#define init(a) memset((a),0,sizeof(a));
int n,a,b,c,ans,k,x,y;
int32_t main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	map<pii,pii>mp;
	For(i,n){
		cin>>a>>b>>c;
		if(a>b)swap(a,b);
		if(b>c)swap(b,c);
		if(a>b)swap(a,b);
		if(a>ans){
			ans=a;
			k=1;
			x=i;
		}
		if(mp.find({b,c})!=mp.end() && min(mp[{b,c}].F+a,min(b,c))>ans){
			ans=min(mp[{b,c}].F+a,min(b,c));
			k=2;
			x = mp[{b,c}].S;
			y = i;
		}
		mp[{a,b}]={c,i};
		mp[{b,c}]={a,i};
		mp[{a,c}]={b,i};
	}
	if(k==1)cout<<k<<endl<<x+1<<endl;
	else cout<<k<<endl<<x+1<<" "<<y+1<<endl;
	return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
map<pii, pii>m;
int n, x, y, z, k, a, b, c, ans;
int main () {
	scanf("%d", &n);
	for (int i=0; i<n; i++) {
		scanf("%d %d %d", &a, &b, &c);
		if (a>b)swap(a, b);
		if (b>c)swap(b, c);
		if (a>b)swap(a, b);
		if (a>ans) {
			ans=a;
			k=1;
			x=i;
		}
		if (m.find({b, c})!=m.end()&&min(m[{b,c}].first+a, min(b, c))>ans) {
			ans=min(m[{b,c}].first+a, min(b, c));
			k=2;
			x=m[{b,c}].second;
			y=i;
		}
		m[{a,b}]=max(m[{a,b}], {c,i});
		m[{b,c}]=max(m[{b,c}], {a, i});
		m[{a,c}]=max(m[{a,c}], {b, i});
	}
	if (k==1)printf("1\n%d\n", x+1);
	else printf("2\n%d %d\n", x+1, y+1);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define eb emplace_back
#define For(i,n) for(int i=0;i<(n);i++)
#define init(a) memset((a),0,sizeof(a));
int n,a,b,c,ans,k,x,y;
int32_t main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	map<pii,pii>mp;
	For(i,n){
		cin>>a>>b>>c;
		if(a>b)swap(a,b);
		if(b>c)swap(b,c);
		if(a>b)swap(a,b);
		if(a>ans){
			ans=a;
			k=1;
			x=i;
		}
		if(mp.find({b,c})!=mp.end() && min(mp[{b,c}].F+a,min(b,c))>ans){
			ans=min(mp[{b,c}].F+a,min(b,c));
			k=2;
			x = mp[{b,c}].S;
			y = i;
		}
		mp[{a,b}]=max(mp[{a,b}],{c,i});
		mp[{b,c}]=max(mp[{b,c}],{a,i});
		mp[{a,c}]=max(mp[{a,c}],{b,i});
	}
	if(k==1)cout<<k<<endl<<x+1<<endl;
	else cout<<k<<endl<<x+1<<" "<<y+1<<endl;
	return 0;

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // pbds
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#pragma GCC optimize("O3")

using namespace __gnu_pbds;
using namespace std;

#define MAXN 200005

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORR(j, i, n) for (int i = j; i < n; i++)
#define FORD(i, n) for (int i = n - 1; i >= 0; i--)
#define F1R(i, n) for (int i = 1; i <= n; i++)
#define F1RD(i, n) for (int i = n; i >= 1; i--)
#define pb push_back
#define mp make_pair
#define ins insert
#define endl '\n'
#define DUEHOANG                  \
	ios_base::sync_with_stdio(0); \
	cin.tie(NULL);                \
	cout.tie(NULL)

#define fileio(in, out)      \
	freopen(in, "r", stdin); \
	freopen(out, "w", stdout);

#define ll long long
#define MOD (1e9*1)+7
#define MOD2 998244353
#define INF (1e9*1)+5

typedef set<int> si;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> iii;
typedef vector<pii> vii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef stack<int> sti;
typedef queue<int> qi;
typedef deque<int> di;
typedef map<int, int> mii;
// ordered_set
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> os;
#define f first
#define s second

#define LEFT(x) 2 * x
#define RIGHT(x) 2 * x + 1

#define bitinc(x) x&-x

const int MAX(int &a, int b)
{
	return a = max(a, b);
}
const int MIN(int &a, int b)
{
	return a = min(a, b);
}

void solve()
{
	int n; cin >> n;
	viii v(n);
	FOR(i, n) cin >> v[i].f >> v[i].s.f >> v[i].s.s;
	map<pii, set<pii> > m;
	int as1 = -1, as2 = -1;
	int x = 0;
	FOR(i, n)
	{
		m[mp(min(v[i].s.f, v[i].s.s), max(v[i].s.f, v[i].s.s))].insert(mp(v[i].f,i+1));
		m[mp(min(v[i].f, v[i].s.s), max(v[i].f, v[i].s.s))].insert(mp(v[i].s.f,i+1));
		m[mp(min(v[i].f, v[i].s.f), max(v[i].f, v[i].s.f))].insert(mp(v[i].s.s,i+1));
		int rad = min(v[i].f, min(v[i].s.f, v[i].s.s));
		if(rad > as1) x=i+1;
		MAX(as1, rad);
	}
	int y = 0, z = 0;
	for(auto k : m)
	{
		pii x = k.f;
		if(m[x].size() < 2) continue;
		int a = prev(m[x].end())->s, b = prev(prev(m[x].end()))->s;
		if(a==b) continue;
		int nh = prev(m[x].end())->f + prev(prev(m[x].end()))->f;
		int rad = min(nh, min(x.f, x.s));
		if(rad > as2) y=a,z=b;
		MAX(as2, rad);
	}
	if(as1 > as2)
	{
		cout << 1 << endl;
		cout << x << endl;
	} else
	{
		cout << 2 << endl;
		cout << y << ' ' << z << endl;
	}
}

signed main()
{
	DUEHOANG;
	int t = 1;
	// cin >> t; // uncomment if it's multitest
	while(t--)
	{
		solve();
	}

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // pbds
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#pragma GCC optimize("O3")

using namespace __gnu_pbds;
using namespace std;

#define MAXN 200005

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORR(j, i, n) for (int i = j; i < n; i++)
#define FORD(i, n) for (int i = n - 1; i >= 0; i--)
#define F1R(i, n) for (int i = 1; i <= n; i++)
#define F1RD(i, n) for (int i = n; i >= 1; i--)
#define pb push_back
#define mp make_pair
#define ins insert
#define endl '\n'
#define DUEHOANG                  \
	ios_base::sync_with_stdio(0); \
	cin.tie(NULL);                \
	cout.tie(NULL)

#define fileio(in, out)      \
	freopen(in, "r", stdin); \
	freopen(out, "w", stdout);

#define ll long long
#define MOD (1e9*1)+7
#define MOD2 998244353
#define INF (1e9*1)+5

typedef set<int> si;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> iii;
typedef vector<pii> vii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef stack<int> sti;
typedef queue<int> qi;
typedef deque<int> di;
typedef map<int, int> mii;
// ordered_set
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> os;
#define f first
#define s second

#define LEFT(x) 2 * x
#define RIGHT(x) 2 * x + 1

#define bitinc(x) x&-x

const int MAX(int &a, int b)
{
	return a = max(a, b);
}
const int MIN(int &a, int b)
{
	return a = min(a, b);
}

void solve()
{
	int n; cin >> n;
	viii v(n);
	FOR(i, n) cin >> v[i].f >> v[i].s.f >> v[i].s.s;
	map<pii, set<pii> > m;
	int as1 = 0, as2 = 0;
	int x = 0;
	FOR(i, n)
	{
		m[mp(min(v[i].s.f, v[i].s.s), max(v[i].s.f, v[i].s.s))].insert(mp(v[i].f,i+1));
		m[mp(min(v[i].f, v[i].s.s), max(v[i].f, v[i].s.s))].insert(mp(v[i].s.f,i+1));
		m[mp(min(v[i].f, v[i].s.f), max(v[i].f, v[i].s.f))].insert(mp(v[i].s.s,i+1));
		int rad = min(v[i].f, min(v[i].s.f, v[i].s.s))/2;
		if(rad > as1) x=i+1;
		MAX(as1, rad);
	}
	int y = 0, z = 0;
	for(auto k : m)
	{
		pii x = k.f;
		if(m[x].size() == 1) continue;
		int nh = prev(m[x].end())->f + prev(prev(m[x].end()))->f;
		int a = prev(m[x].end())->s, b = prev(prev(m[x].end()))->s;
		int rad = min(nh, min(x.f, x.s))/2;
		if(rad > as2) y=a,z=b;
		MAX(as2, rad);
	}
	if(as1 > as2)
	{
		cout << 1 << endl;
		cout << x << endl;
	} else
	{
		cout << 2 << endl;
		cout << y << ' ' << z << endl;
	}
}

signed main()
{
	DUEHOANG;
	int t = 1;
	// cin >> t; // uncomment if it's multitest
	while(t--)
	{
		solve();
	}

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // pbds
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#pragma GCC optimize("O3")

using namespace __gnu_pbds;
using namespace std;

#define MAXN 200005

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORR(j, i, n) for (int i = j; i < n; i++)
#define FORD(i, n) for (int i = n - 1; i >= 0; i--)
#define F1R(i, n) for (int i = 1; i <= n; i++)
#define F1RD(i, n) for (int i = n; i >= 1; i--)
#define pb push_back
#define mp make_pair
#define ins insert
#define endl '\n'
#define DUEHOANG                  \
	ios_base::sync_with_stdio(0); \
	cin.tie(NULL);                \
	cout.tie(NULL)

#define fileio(in, out)      \
	freopen(in, "r", stdin); \
	freopen(out, "w", stdout);

#define ll long long
#define MOD (1e9*1)+7
#define MOD2 998244353
#define INF (1e9*1)+5

typedef set<int> si;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> iii;
typedef vector<pii> vii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef stack<int> sti;
typedef queue<int> qi;
typedef deque<int> di;
typedef map<int, int> mii;
// ordered_set
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> os;
#define f first
#define s second

#define LEFT(x) 2 * x
#define RIGHT(x) 2 * x + 1

#define bitinc(x) x&-x

const int MAX(int &a, int b)
{
	return a = max(a, b);
}
const int MIN(int &a, int b)
{
	return a = min(a, b);
}

void solve()
{
	int n; cin >> n;
	viii v(n);
	FOR(i, n) cin >> v[i].f >> v[i].s.f >> v[i].s.s;
	map<pii, set<pii> > m;
	int as1 = -1, as2 = -1;
	int x = 0;
	FOR(i, n)
	{
		m[mp(min(v[i].s.f, v[i].s.s), max(v[i].s.f, v[i].s.s))].insert(mp(v[i].f,i+1));
		m[mp(min(v[i].f, v[i].s.s), max(v[i].f, v[i].s.s))].insert(mp(v[i].s.f,i+1));
		m[mp(min(v[i].f, v[i].s.f), max(v[i].f, v[i].s.f))].insert(mp(v[i].s.s,i+1));
		int rad = min(v[i].f, min(v[i].s.f, v[i].s.s))/2;
		if(rad > as1) x=i+1;
		MAX(as1, rad);
	}
	int y = 0, z = 0;
	for(auto k : m)
	{
		pii x = k.f;
		if(m[x].size() < 2) continue;
		int a = prev(m[x].end())->s, b = prev(prev(m[x].end()))->s;
		if(a==b) continue;
		int nh = prev(m[x].end())->f + prev(prev(m[x].end()))->f;
		int rad = min(nh, min(x.f, x.s))/2;
		if(rad > as2) y=a,z=b;
		MAX(as2, rad);
	}
	if(as1 > as2)
	{
		cout << 1 << endl;
		cout << x << endl;
	} else
	{
		cout << 2 << endl;
		cout << y << ' ' << z << endl;
	}
}

signed main()
{
	DUEHOANG;
	int t = 1;
	// cin >> t; // uncomment if it's multitest
	while(t--)
	{
		solve();
	}

}


#include <stdio.h>
#include <iostream>
#include <math.h>
#include <map>
#include <utility>
#include <iterator>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
pair<int, int> order(int a, int b){
    if(a > b)
      return make_pair(a, b);
    return make_pair(b, a);
}
int findMin(int a, int b, int c){
    int minimum = min(a, b);
    minimum = min(minimum, c);
    return minimum;
}
int main(void){
    int a, b, c, n, max = 0, flag = 1, count, compre;
    vector<int> ans(2, 0);
    map<pair<int, int>, set<pair<int, int> > > record;
    pair<int, int> p1, p2, p3;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d %d %d", &a, &b, &c);
        p1 = order(a, b);
        p2 = order(b, c);
        p3 = order(a, c);
        record[p1].insert({c, i});
        record[p2].insert({a, i});
        record[p3].insert({b, i});
    }
    for(map<pair<int, int>, set<pair<int, int> > >::iterator it = record.begin(); it != record.end(); ++it){
        if((it -> second).size() == 1){
            flag = 1;
            compre = findMin(it->first.first, it->first.second, it->second.begin()->first);
        }
        else{
            flag = 2;
            compre = findMin(it->first.first, it->first.second, it->second.rbegin()->first + (++(it->second.rbegin()))->first);
        }
        if(compre > max){
            count = flag;
            if(count == 1)
              ans[0] = it->second.begin()->second;
            else{
                ans[0] = (++(it->second.rbegin()))->second;
                ans[1] = it->second.rbegin()->second;
            }
        }
    }
    printf("%d\n", count);
    sort(ans.begin(), ans.end());
    for(int i = 0; i < count; i++)
      printf("%d ", ans[i]);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <math.h>
#include <map>
#include <utility>
#include <iterator>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
pair<int, int> order(int a, int b){
    if(a > b)
      return make_pair(a, b);
    return make_pair(b, a);
}
int findMin(int a, int b, int c){
    int minimum = min(a, b);
    minimum = min(minimum, c);
    return minimum;
}
int main(void){
    int a, b, c, n, max = 0, flag = 1, count, compre;
    vector<int> ans(2, 0);
    map<pair<int, int>, set<pair<int, int> > > record;
    pair<int, int> p1, p2, p3;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d %d %d", &a, &b, &c);
        p1 = order(a, b);
        p2 = order(b, c);
        p3 = order(a, c);
        record[p1].insert({c, i});
        record[p2].insert({a, i});
        record[p3].insert({b, i});
    }
    for(map<pair<int, int>, set<pair<int, int> > >::iterator it = record.begin(); it != record.end(); ++it){
        if((it -> second).size() == 1){
            flag = 1;
            compre = findMin(it->first.first, it->first.second, it->second.begin()->first);
        }
        else{
            flag = 2;
            compre = findMin(it->first.first, it->first.second, it->second.rbegin()->first + (++(it->second.rbegin()))->first);
        }
        if(compre > max){
            count = flag;
            max = compre;
            if(count == 1)
              ans[0] = it->second.begin()->second;
            else{
                ans[0] = (++(it->second.rbegin()))->second;
                ans[1] = it->second.rbegin()->second;
            }
        }
    }
    printf("%d\n", count);
    int temp;
    if(count == 2 && ans[0] > ans[1]){
        temp = ans[0];
        ans[0] = ans[1];
        ans[1] = temp;
    }
    for(int i = 0; i < count; i++)
      printf("%d ", ans[i]);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <math.h>
#include <map>
#include <utility>
#include <iterator>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
pair<int, int> order(int a, int b){
    if(a > b)
      return make_pair(a, b);
    return make_pair(b, a);
}
int findMin(int a, int b, int c){
    int minimum = min(a, b);
    minimum = min(minimum, c);
    return minimum;
}
int main(void){
    int a, b, c, n, max = 0, flag = 1, count, compre;
    vector<int> ans(2, 0);
    map<pair<int, int>, set<pair<int, int> > > record;
    pair<int, int> p1, p2, p3;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d %d %d", &a, &b, &c);
        p1 = order(a, b);
        p2 = order(b, c);
        p3 = order(a, c);
        record[p1].insert({c, i});
        record[p2].insert({a, i});
        record[p3].insert({b, i});
    }
    for(map<pair<int, int>, set<pair<int, int> > >::iterator it = record.begin(); it != record.end(); ++it){
        if((it -> second).size() == 1){
            flag = 1;
            compre = findMin(it->first.first, it->first.second, it->second.begin()->first);
        }
        else{
            flag = 2;
            compre = findMin(it->first.first, it->first.second, it->second.rbegin()->first + (++(it->second.rbegin()))->first);
        }
        if(compre > max){
            count = flag;
            if(count == 1)
              ans[0] = it->second.begin()->second;
            else{
                ans[0] = (++(it->second.rbegin()))->second;
                ans[1] = it->second.rbegin()->second;
            }
        }
    }
    printf("%d\n", count);
    int temp;
    if(count == 2 && ans[0] > ans[1]){
        temp = ans[0];
        ans[0] = ans[1];
        ans[1] = temp;
    }
    for(int i = 0; i < count; i++)
      printf("%d ", ans[i]);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <math.h>
#include <map>
#include <utility>
#include <iterator>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
pair<int, int> order(int a, int b){
    if(a > b)
      return make_pair(a, b);
    return make_pair(b, a);
}
int findMin(int a, int b, int c){
    int minimum = min(a, b);
    minimum = min(minimum, c);
    return minimum;
}
int main(void){
    int a, b, c, n, max = 0, flag = 1, count, compre;
    vector<int> ans(2, 0);
    map<pair<int, int>, set<pair<int, int> > > record;
    pair<int, int> p1, p2, p3;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d %d %d", &a, &b, &c);
        p1 = order(a, b);
        p2 = order(b, c);
        p3 = order(a, c);
        record[p1].insert({c, i});
        record[p2].insert({a, i});
        record[p3].insert({b, i});
    }
    for(map<pair<int, int>, set<pair<int, int> > >::iterator it = record.begin(); it != record.end(); ++it){
        if((it -> second).size() == 1){
            flag = 1;
            compre = findMin(it->first.first, it->first.second, it->second.begin()->first);
        }
        else{
            flag = 2;
            compre = findMin(it->first.first, it->first.second, it->second.rbegin()->first + (++(it->second.rbegin()))->first);
        }
        if(compre > max){
            count = flag;
            if(count == 1)
              ans[0] = it->second.begin()->second;
            else{
                ans[0] = (++(it->second.rbegin()))->second;
                ans[1] = it->second.rbegin()->second;
            }
        }
    }
    printf("%d\n", count);
    sort(ans.begin(), ans.end());
    for(int i = 0; i < 2; i++)
      if(ans[i] != 0)
        printf("%d ", ans[i]);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define MAXN (int)(2e5 + 5)
#define MAXM (int)(1e2+5)
#define fr first
#define sd second
#define MP make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define M0(a) memset(a, 0, sizeof(a))
#define M1(a) memset(a, -1, sizeof(a))
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REPN(i,n,m) for(int i = m; i <= int(n); i++)
#define RREP(i,n) for(int i = int(n-1); i >= 0; i--)
#define RREPN(i, n, m) for(int i = n; i >= (int)m; i--)
typedef long long ll;
typedef double db;
typedef long double ld;
const ll INF= int(1e11 + 7);
const ll MOD = int(1e9 + 7);
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, pii> ppii;
template<typename T, typename U> inline void AMIN(T &x, U y){ if(x > y) x = y;}
template<typename T, typename U> inline void AMAX(T &x, U y){ if(x < y) x = y;}

int main() {
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n;
        cin >> n;

        map<ll, vector<pll>> cube;
        REP(i, n) {

                ll a, b, c;
                cin >> a >> b >> c;

                set<pll> S;
                S.insert({a * b, c});
                S.insert({b * c, a});
                S.insert({a * c, b});
                for(pll x : S)
                        cube[x.fr].pb({x.sd, i + 1});
        }

        vector<ll> ans = {1, 1, -1, -1};
        for(auto VV : cube) {

                ll A = VV.fr;
                vector<pll> V = VV.sd;

                sort(ALL(V));
                reverse(ALL(V));

                if(ans[1] / V[0].fr <= A / ans[0])
                        ans = {A, V[0].fr, V[0].sd, -1};

                if(V.size() > 1)
                        if(ans[1] / (V[0].fr + V[1].fr) <= A / ans[0])
                                ans = {A, V[0].fr + V[1].fr, V[0].sd, V[1].sd};
        }

        if(ans[3] == -1)
                cout << 1 << endl << ans[2] << endl;
        else
                cout << 2 << endl << ans[2] <<  " " << ans[3] << endl;
        return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define MAXN (int)(2e5 + 5)
#define MAXM (int)(1e2+5)
#define fr first
#define sd second
#define MP make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define M0(a) memset(a, 0, sizeof(a))
#define M1(a) memset(a, -1, sizeof(a))
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REPN(i,n,m) for(int i = m; i <= int(n); i++)
#define RREP(i,n) for(int i = int(n-1); i >= 0; i--)
#define RREPN(i, n, m) for(int i = n; i >= (int)m; i--)
typedef long long ll;
typedef double db;
typedef long double ld;
const ll INF= int(1e11 + 7);
const ll MOD = int(1e9 + 7);
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, pii> ppii;
template<typename T, typename U> inline void AMIN(T &x, U y){ if(x > y) x = y;}
template<typename T, typename U> inline void AMAX(T &x, U y){ if(x < y) x = y;}

int main() {
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n;
        cin >> n;

        map<pll, vector<pll>> cube;
        REP(i, n) {

                ll a, b, c;
                cin >> a >> b >> c;

                ll x = min(a, min(b, c)), z = max(a, max(b, c)), y = a + b + c - x - z;

                map<vector<ll>, int> M;
                M[{x, y, z}]++;
                M[{x, z, y}]++;
                M[{y, z, x}]++;
                for(auto VV : M) {

                        vector<ll> V = VV.fr;
                        cube[{V[0], V[1]}].pb({V[2], i + 1});
                }
        }

        vector<ll> ans = {1, -1, -1};
        for(auto VV : cube) {

                pll A = VV.fr;
                vector<pll> V = VV.sd;

                sort(ALL(V));
                reverse(ALL(V));

                if(ans[0] <= min(A.fr, V[0].fr))
                        ans = {min(A.fr, V[0].fr), V[0].sd, -1};

                if(V.size() > 1)
                        if(ans[0] <= min(A.fr, V[0].fr + V[1].fr))
                                ans = {min(A.fr, V[0].fr + V[1].fr), V[0].sd, V[1].sd};
        }

        if(ans[2] == -1)
                cout << 1 << endl << ans[1] << endl;
        else
                cout << 2 << endl << ans[1] << " " << ans[2] << endl;

        return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define MAXN (int)(2e5 + 5)
#define MAXM (int)(1e2+5)
#define fr first
#define sd second
#define MP make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define M0(a) memset(a, 0, sizeof(a))
#define M1(a) memset(a, -1, sizeof(a))
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REPN(i,n,m) for(int i = m; i <= int(n); i++)
#define RREP(i,n) for(int i = int(n-1); i >= 0; i--)
#define RREPN(i, n, m) for(int i = n; i >= (int)m; i--)
typedef long long ll;
typedef double db;
typedef long double ld;
const ll INF= int(1e11 + 7);
const ll MOD = int(1e9 + 7);
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, pii> ppii;
template<typename T, typename U> inline void AMIN(T &x, U y){ if(x > y) x = y;}
template<typename T, typename U> inline void AMAX(T &x, U y){ if(x < y) x = y;}

int main() {
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n;
        cin >> n;

        map<ll, vector<pll>> cube;
        REP(i, n) {

                ll a, b, c;
                cin >> a >> b >> c;

                set<pll> S;
                S.insert({min(a, b), c});
                S.insert({min(b, c), a});
                S.insert({min(a, c), b});
                for(pll x : S)
                        cube[x.fr].pb({x.sd, i + 1});
        }

        vector<ll> ans = {1, -1, -1};
        for(auto VV : cube) {

                ll A = VV.fr;
                vector<pll> V = VV.sd;

                sort(ALL(V));
                reverse(ALL(V));

                if(ans[0] <= min(A, V[0].fr))
                        ans = {min(A, V[0].fr), V[0].sd, -1};

                if(V.size() > 1)
                        if(ans[0] <= min(A, V[0].fr + V[1].fr))
                                ans = {min(A, V[0].fr + V[1].fr), V[0].sd, V[1].sd};

        }

        if(ans[2] == -1)
                cout << 1 << endl << ans[1] << endl;
        else
                cout << 2 << endl << ans[1] <<  " " << ans[2] << endl;
        return 0;
}


#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <sstream>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <fstream>
#include <ctime>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    map<pair<int, int>, stack<pair<int, int> > > mp;
    int n;
    cin >> n;
    vector<int> s[n];
    int ans = 0;
    int k = 0;
    vector<int> p;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            int x;
            cin >> x;
            s[i].push_back(x);
        }

        sort(s[i].begin(), s[i].end());
    }

    for (int i = n - 1; i >= 0; i--) {
        do {
            pair<int, int> key = {s[i][0], s[i][1]};
            int side = s[i][2];
            auto& val = mp[key];

            if (val.empty() || val.top().first <= side) {
                val.push({side, i + 1});
            }
        } while (next_permutation(s[i].begin(), s[i].end()));
    }

    for (int i = 0; i < n; i++) {
        sort(s[i].begin(), s[i].end());

        do {
            pair<int, int> key = {s[i][0], s[i][1]};
            int side = s[i][2];
            auto& val = mp[key];

            if (!val.empty() && val.top().second == i + 1) {
                val.pop();
            }

            int len = side;
            int sz = 1;
            vector<int> el = {i + 1};

            if (!val.empty()) {
                len += val.top().first;
                el.push_back(val.top().second);
                sz++;
            }

            len = min(len, min(key.first, key.second));

            if (len > ans) {
                ans = len;
                p = el;
                k = sz;
            }
        } while (next_permutation(s[i].begin(), s[i].end()));
    }

    cout << k << "\n";

    for (int x : p) {
        cout << x << " ";
    }

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <sstream>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <fstream>
#include <ctime>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    map<pair<int, int>, stack<pair<int, int> > > mp;
    int n;
    cin >> n;
    vector<int> s[n];
    int ans = 0;
    int k = 0;
    vector<int> p;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            int x;
            cin >> x;
            s[i].push_back(x);
        }

        sort(s[i].begin(), s[i].end());
    }

    for (int i = n - 1; i >= 0; i--) {
        set<pair<int, int> > distinct;

        do {
            pair<int, int> key = {s[i][0], s[i][1]};

            if (distinct.find(key) != distinct.end()) continue;

            distinct.insert(key);
            int side = s[i][2];
            auto& val = mp[key];

            if (val.empty() || val.top().first <= side) {
                val.push({side, i + 1});
            }
        } while (next_permutation(s[i].begin(), s[i].end()));
    }

    for (int i = 0; i < n; i++) {
        sort(s[i].begin(), s[i].end());
        set<pair<int, int> > distinct;

        do {
            pair<int, int> key = {s[i][0], s[i][1]};

            if (distinct.find(key) != distinct.end()) continue;

            distinct.insert(key);

            int side = s[i][2];
            auto& val = mp[key];

            if (!val.empty() && val.top().second == i + 1) {
                val.pop();
            }

            int len = side;
            int sz = 1;
            vector<int> el = {i + 1};

            if (!val.empty()) {
                len += val.top().first;
                el.push_back(val.top().second);
                sz++;
            }

            len = min(len, min(key.first, key.second));

            if (len > ans) {
                ans = len;
                p = el;
                k = sz;
            }
        } while (next_permutation(s[i].begin(), s[i].end()));
    }

    cout << k << "\n";

    for (int x : p) {
        cout << x << " ";
    }

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <sstream>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <fstream>
#include <ctime>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    map<pair<int, int>, vector<pair<int, int> > > mp;
    int n;
    cin >> n;
    vector<int> s[n];
    int ans = 0;
    int k = 0;
    vector<int> p;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            int x;
            cin >> x;
            s[i].push_back(x);
        }

        sort(s[i].begin(), s[i].end());
    }

    for (int i = n - 1; i >= 0; i--) {
        set<pair<int, int> > distinct;

        do {
            pair<int, int> key = {s[i][0], s[i][1]};

            if (distinct.find(key) != distinct.end()) continue;

            distinct.insert(key);

            int side = s[i][2];
            auto& val = mp[key];
            val.push_back({side, i + 1});
            sort(val.begin(), val.end(), greater<pair<int, int> >());

            if (val.size() == 3) {
                val.pop_back();
            }

        } while (next_permutation(s[i].begin(), s[i].end()));
    }

    for (int i = 0; i < n; i++) {
        sort(s[i].begin(), s[i].end());
        set<pair<int, int> > distinct;

        do {
            pair<int, int> key = {s[i][0], s[i][1]};

            if (distinct.find(key) != distinct.end()) continue;

            distinct.insert(key);

            int side = s[i][2];
            auto& val = mp[key];
            int len = side;
            int sz = 1;
            vector<int> el = {i + 1};

            if (val.size() > 1) {
                pair<int,int> par = val[0].second == i + 1 ? val[1] : val[0];
                len += par.first;
                el.push_back(par.second);
                sz++;
            }

            len = min(len, min(key.first, key.second));

            if (len > ans) {
                ans = len;
                p = el;
                k = sz;
            }
        } while (next_permutation(s[i].begin(), s[i].end()));
    }

    cout << k << "\n";

    for (int x : p) {
        cout << x << " ";
    }

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n,c[4];
struct as{
int x,y,z,qw;}a[100008];
bool cmp(as a,as b)
{
    if(a.y!=b.y)  return a.y<b.y;
    if(a.z!=b.z)  return a.z<b.z;
    return a.x<b.x;
}
int main()
{
    cin.tie(0);
    cout.tie(0);
    int q,s1=0,s2=0,x,y,z;
    cin>>n;
    FOR(i,1,n)
    {
        si(c[1]),si(c[2]),si(c[3]);
        sort(c+1,c+4);
        if(c[1]>s1)  s1=c[1],x=i;
        a[i].x=c[1],a[i].y=c[2],a[i].z=c[3],a[i].qw=i;
    }
    sort(a+1,a+n+1,cmp);
    FOR(i,1,n-1)
    {
        if(a[i].y==a[i+1].y&&a[i].z==a[i+1].z)
        {
            q=min(a[i].y,a[i].x+a[i+1].x);
            if(q>s2)  s2=q,z=a[i].qw,y=a[i+1].qw;
        }
    }
    if(s1>=s2)   cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[6];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        q=min(a[i].x,a[i].y);
        q=min(a[i].z,q);
        if(q>s1)  s1=q,x=i;
        if(a[i].z>=mp[0][P(a[i].x,a[i].y)].first)mp[1][P(a[i].x,a[i].y)]=mp[0][P(a[i].x,a[i].y)],mp[0][P(a[i].x,a[i].y)]=P(a[i].z,i);
        else if(a[i].z>=mp[1][P(a[i].x,a[i].y)].first)mp[1][P(a[i].x,a[i].y)]=P(a[i].z,i);
        if(a[i].x>=mp[2][P(a[i].y,a[i].z)].first)mp[3][P(a[i].y,a[i].z)]=mp[2][P(a[i].y,a[i].z)],mp[2][P(a[i].y,a[i].z)]=P(a[i].x,i);
        else if(a[i].x>=mp[3][P(a[i].y,a[i].z)].first)mp[3][P(a[i].y,a[i].z)]=P(a[i].x,i);
        if(a[i].y>=mp[4][P(a[i].x,a[i].z)].first)mp[5][P(a[i].x,a[i].z)]=mp[4][P(a[i].x,a[i].z)],mp[4][P(a[i].x,a[i].z)]=P(a[i].y,i);
        else if(a[i].y>=mp[5][P(a[i].x,a[i].z)].first)mp[5][P(a[i].x,a[i].z)]=P(a[i].y,i);
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].x,a[i].y)].first,zzz=mp[1][P(a[i].x,a[i].y)].first;
        if(zz&&zzz)
        {
            q=min(a[i].x,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[0][P(a[i].x,a[i].y)].second,z=mp[1][P(a[i].x,a[i].y)].second;
        }
        zz=mp[2][P(a[i].y,a[i].z)].first,zzz=mp[3][P(a[i].y,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].z,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[2][P(a[i].y,a[i].z)].second,z=mp[3][P(a[i].y,a[i].z)].second;
        }
        zz=mp[4][P(a[i].x,a[i].z)].first,zzz=mp[5][P(a[i].x,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].x,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[4][P(a[i].x,a[i].z)].second,z=mp[5][P(a[i].x,a[i].z)].second;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[6];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        if(a[i].x>a[i].y)  swap(a[i].x,a[i].y);
        if(a[i].x>a[i].z)  swap(a[i].x,a[i].z);
        if(a[i].y>a[i].z)  swap(a[i].z,a[i].y);
        q=min(a[i].x,a[i].y);
        q=min(a[i].z,q);
        if(q>s1)  s1=q,x=i;
        if(a[i].z>mp[0][P(a[i].x,a[i].y)].first)mp[0][P(a[i].x,a[i].y)]=P(a[i].z,i);
        else if(a[i].z>mp[1][P(a[i].x,a[i].y)].first)mp[1][P(a[i].x,a[i].y)]=P(a[i].z,i);
        if(a[i].x>mp[2][P(a[i].y,a[i].z)].first)mp[2][P(a[i].y,a[i].z)]=P(a[i].x,i);
        else if(a[i].x>mp[3][P(a[i].y,a[i].z)].first)mp[3][P(a[i].y,a[i].z)]=P(a[i].x,i);
        if(a[i].y>mp[4][P(a[i].x,a[i].z)].first)mp[4][P(a[i].x,a[i].z)]=P(a[i].y,i);
        else if(a[i].y>mp[5][P(a[i].x,a[i].z)].first)mp[5][P(a[i].x,a[i].z)]=P(a[i].y,i);
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].x,a[i].y)].first,zzz=mp[1][P(a[i].x,a[i].y)].first;
        if(zz&&zzz)
        {
            q=min(a[i].x,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[0][P(a[i].x,a[i].y)].second,z=mp[1][P(a[i].x,a[i].y)].second;
        }
        zz=mp[2][P(a[i].y,a[i].z)].first,zzz=mp[3][P(a[i].y,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].z,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[2][P(a[i].y,a[i].z)].second,z=mp[3][P(a[i].y,a[i].z)].second;
        }
        zz=mp[4][P(a[i].x,a[i].z)].first,zzz=mp[5][P(a[i].x,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].x,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[4][P(a[i].x,a[i].z)].second,z=mp[5][P(a[i].x,a[i].z)].second;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[6];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        q=min(a[i].x,a[i].y);
        q=min(a[i].z,q);
        if(q>s1)  s1=q,x=i;
        if(a[i].z>mp[0][P(a[i].x,a[i].y)].first)mp[1][P(a[i].x,a[i].y)]=mp[0][P(a[i].x,a[i].y)],mp[0][P(a[i].x,a[i].y)]=P(a[i].z,i);
        else if(a[i].z>mp[1][P(a[i].x,a[i].y)].first)mp[1][P(a[i].x,a[i].y)]=P(a[i].z,i);
        if(a[i].x>mp[2][P(a[i].y,a[i].z)].first)mp[3][P(a[i].y,a[i].z)]=mp[2][P(a[i].y,a[i].z)],mp[2][P(a[i].y,a[i].z)]=P(a[i].x,i);
        else if(a[i].x>mp[3][P(a[i].y,a[i].z)].first)mp[3][P(a[i].y,a[i].z)]=P(a[i].x,i);
        if(a[i].y>mp[4][P(a[i].x,a[i].z)].first)mp[5][P(a[i].x,a[i].z)]=mp[4][P(a[i].x,a[i].z)],mp[4][P(a[i].x,a[i].z)]=P(a[i].y,i);
        else if(a[i].y>mp[5][P(a[i].x,a[i].z)].first)mp[5][P(a[i].x,a[i].z)]=P(a[i].y,i);
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].x,a[i].y)].first,zzz=mp[1][P(a[i].x,a[i].y)].first;
        if(zz&&zzz)
        {
            q=min(a[i].x,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[0][P(a[i].x,a[i].y)].second,z=mp[1][P(a[i].x,a[i].y)].second;
        }
        zz=mp[2][P(a[i].y,a[i].z)].first,zzz=mp[3][P(a[i].y,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].z,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[2][P(a[i].y,a[i].z)].second,z=mp[3][P(a[i].y,a[i].z)].second;
        }
        zz=mp[4][P(a[i].x,a[i].z)].first,zzz=mp[5][P(a[i].x,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].x,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[4][P(a[i].x,a[i].z)].second,z=mp[5][P(a[i].x,a[i].z)].second;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[2];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz,zzzz,zzzzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        if(a[i].x>a[i].y)  swap(a[i].x,a[i].y);
        if(a[i].x>a[i].z)  swap(a[i].x,a[i].z);
        if(a[i].y>a[i].z)  swap(a[i].z,a[i].y);
        if(a[i].x>s1)  s1=a[i].x,x=i;
        if(mp[0][P(a[i].y,a[i].z)].first<a[i].x) mp[0][P(a[i].y,a[i].z)].first=a[i].x;
        else if(mp[1][P(a[i].y,a[i].z)].first<a[i].x) mp[1][P(a[i].y,a[i].z)].first=a[i].x;
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].y,a[i].z)].first,zzz=mp[1][P(a[i].y,a[i].z)].first;
        zzzz=mp[0][P(a[i].y,a[i].z)].second,zzzzz=mp[1][P(a[i].y,a[i].z)].second;
        if(zz&&zzz&&(zzzz==i||zzzzz==i))
        {
            q=min(a[i].y,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[0][P(a[i].y,a[i].z)].second,z=mp[1][P(a[i].y,a[i].z)].second;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[2];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz,zzzz,zzzzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        if(a[i].x>a[i].y)  swap(a[i].x,a[i].y);
        if(a[i].x>a[i].z)  swap(a[i].x,a[i].z);
        if(a[i].y>a[i].z)  swap(a[i].z,a[i].y);
        if(a[i].x>s1)  s1=a[i].x,x=i;
        if(mp[0][P(a[i].y,a[i].z)].first<a[i].x) mp[0][P(a[i].y,a[i].z)]=P(a[i].x,i),mp[1][P(a[i].y,a[i].z)]=mp[0][P(a[i].y,a[i].z)];
        else if(mp[1][P(a[i].y,a[i].z)].first<a[i].x) mp[1][P(a[i].y,a[i].z)]=P(a[i].x,i);
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].y,a[i].z)].first,zzz=mp[1][P(a[i].y,a[i].z)].first;
        zzzz=mp[0][P(a[i].y,a[i].z)].second,zzzzz=mp[1][P(a[i].y,a[i].z)].second;
        if(zz&&zzz&&(zzzz==i||zzzzz==i))
        {
            q=min(a[i].y,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=zzzz,z=zzzzz;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[6];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        if(a[i].x>a[i].y)  swap(a[i].x,a[i].y);
        if(a[i].x>a[i].z)  swap(a[i].x,a[i].z);
        if(a[i].y>a[i].z)  swap(a[i].z,a[i].y);
        q=min(a[i].x,a[i].y);
        q=min(a[i].z,q);
        if(q>s1)  s1=q,x=i;
        if(a[i].z>mp[0][P(a[i].x,a[i].y)].first)mp[0][P(a[i].x,a[i].y)]=P(a[i].z,i);
        else if(a[i].z>mp[1][P(a[i].x,a[i].y)].first)mp[1][P(a[i].x,a[i].y)]=P(a[i].z,i);
        if(a[i].x>mp[2][P(a[i].y,a[i].z)].first)mp[2][P(a[i].y,a[i].z)]=P(a[i].x,i);
        else if(a[i].x>mp[3][P(a[i].y,a[i].z)].first)mp[3][P(a[i].y,a[i].z)]=P(a[i].x,i);
        if(a[i].y>mp[4][P(a[i].x,a[i].z)].first)mp[4][P(a[i].x,a[i].z)]=P(a[i].y,i);
        else if(a[i].y>mp[5][P(a[i].x,a[i].z)].first)mp[5][P(a[i].x,a[i].z)]=P(a[i].y,i);
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].y,a[i].z)].first,zzz=mp[1][P(a[i].y,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].z,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[0][P(a[i].y,a[i].z)].second,z=mp[1][P(a[i].y,a[i].z)].second;
        }
        zz=mp[2][P(a[i].y,a[i].z)].first,zzz=mp[3][P(a[i].y,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].z,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[2][P(a[i].y,a[i].z)].second,z=mp[3][P(a[i].y,a[i].z)].second;
        }
        zz=mp[4][P(a[i].y,a[i].z)].first,zzz=mp[5][P(a[i].y,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].y,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[4][P(a[i].y,a[i].z)].second,z=mp[5][P(a[i].y,a[i].z)].second;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[2];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz,zzzz,zzzzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        if(a[i].x>a[i].y)  swap(a[i].x,a[i].y);
        if(a[i].x>a[i].z)  swap(a[i].x,a[i].z);
        if(a[i].y>a[i].z)  swap(a[i].z,a[i].y);
        if(a[i].x>s1)  s1=a[i].x,x=i;
        if(mp[0][P(a[i].y,a[i].z)].first<a[i].x) mp[1][P(a[i].y,a[i].z)]=mp[0][P(a[i].y,a[i].z)],mp[0][P(a[i].y,a[i].z)]=P(a[i].x,i);
        else if(mp[1][P(a[i].y,a[i].z)].first<a[i].x) mp[1][P(a[i].y,a[i].z)]=P(a[i].x,i);
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].y,a[i].z)].first,zzz=mp[1][P(a[i].y,a[i].z)].first;
        zzzz=mp[0][P(a[i].y,a[i].z)].second,zzzzz=mp[1][P(a[i].y,a[i].z)].second;
        if(zz&&zzz&&(zzzz==i||zzzzz==i))
        {
            q=min(a[i].y,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=zzzz,z=zzzzz;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[2];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        if(a[i].x>a[i].y)  swap(a[i].x,a[i].y);
        if(a[i].x>a[i].z)  swap(a[i].x,a[i].z);
        if(a[i].y>a[i].z)  swap(a[i].z,a[i].y);
        if(a[i].x>s1)  s1=a[i].x,x=i;
        if(mp[0][P(a[i].y,a[i].z)].first<a[i].x) mp[0][P(a[i].y,a[i].z)].first=a[i].x;
        else if(mp[1][P(a[i].y,a[i].z)].first<a[i].x) mp[1][P(a[i].y,a[i].z)].first=a[i].x;
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].y,a[i].z)].first,zzz=mp[1][P(a[i].y,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].y,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[0][P(a[i].y,a[i].z)].second,z=mp[1][P(a[i].y,a[i].z)].second;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[2];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz,zzzz,zzzzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        if(a[i].x>a[i].y)  swap(a[i].x,a[i].y);
        if(a[i].x>a[i].z)  swap(a[i].x,a[i].z);
        if(a[i].y>a[i].z)  swap(a[i].z,a[i].y);
        if(a[i].x>s1)  s1=a[i].x,x=i;
        if(mp[0][P(a[i].y,a[i].z)].first<a[i].x) mp[0][P(a[i].y,a[i].z)]=P(a[i].x,i);
        else if(mp[1][P(a[i].y,a[i].z)].first<a[i].x) mp[1][P(a[i].y,a[i].z)]=P(a[i].x,i);
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].y,a[i].z)].first,zzz=mp[1][P(a[i].y,a[i].z)].first;
        zzzz=mp[0][P(a[i].y,a[i].z)].second,zzzzz=mp[1][P(a[i].y,a[i].z)].second;
        if(zz&&zzz&&(zzzz==i||zzzzz==i))
        {
            q=min(a[i].y,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[0][P(a[i].y,a[i].z)].second,z=mp[1][P(a[i].y,a[i].z)].second;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n;
map<P,P> mp[6];
struct as{
int x,y,z;}a[100008];
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int x,y,z,q,s1=0,s2=0,zz,zzz;
    FOR(i,1,n)
    {
        si(a[i].x),si(a[i].y),si(a[i].z);
        q=min(a[i].x,a[i].y);
        q=min(a[i].z,q);
        if(q>s1)  s1=q,x=i;
        if(a[i].z>mp[0][P(a[i].x,a[i].y)].first)mp[0][P(a[i].x,a[i].y)]=P(a[i].z,i);
        else if(a[i].z>mp[1][P(a[i].x,a[i].y)].first)mp[1][P(a[i].x,a[i].y)]=P(a[i].z,i);
        if(a[i].x>mp[2][P(a[i].y,a[i].z)].first)mp[2][P(a[i].y,a[i].z)]=P(a[i].x,i);
        else if(a[i].x>mp[3][P(a[i].y,a[i].z)].first)mp[3][P(a[i].y,a[i].z)]=P(a[i].x,i);
        if(a[i].y>mp[4][P(a[i].x,a[i].z)].first)mp[4][P(a[i].x,a[i].z)]=P(a[i].y,i);
        else if(a[i].y>mp[5][P(a[i].x,a[i].z)].first)mp[5][P(a[i].x,a[i].z)]=P(a[i].y,i);
    }
    FOR(i,1,n)
    {
        zz=mp[0][P(a[i].x,a[i].y)].first,zzz=mp[1][P(a[i].x,a[i].y)].first;
        if(zz&&zzz)
        {
            q=min(a[i].x,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[0][P(a[i].x,a[i].y)].second,z=mp[1][P(a[i].x,a[i].y)].second;
        }
        zz=mp[2][P(a[i].y,a[i].z)].first,zzz=mp[3][P(a[i].y,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].z,a[i].y),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[2][P(a[i].y,a[i].z)].second,z=mp[3][P(a[i].y,a[i].z)].second;
        }
        zz=mp[4][P(a[i].x,a[i].z)].first,zzz=mp[5][P(a[i].x,a[i].z)].first;
        if(zz&&zzz)
        {
            q=min(a[i].x,a[i].z),q=min(q,zz+zzz);
            if(q>s2)  s2=q,y=mp[4][P(a[i].x,a[i].z)].second,z=mp[5][P(a[i].x,a[i].z)].second;
        }
    }
    if(s1>s2)  cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
int n,c[4];
struct as{
int x,y,z,qw;}a[100008];
bool cmp(as a,as b)
{
    if(a.y!=b.y)  return a.y<b.y;
    if(a.z!=b.z)  return a.z<b.z;
    return a.x<b.x;
}
int main()
{
    cin.tie(0);
    cout.tie(0);
    int q,s1=0,s2=0,x,y,z;
    cin>>n;
    FOR(i,1,n)
    {
        si(c[1]),si(c[2]),si(c[3]);
        sort(c+1,c+4);
        if(c[1]>s2)  s2=c[1],x=i;
        a[i].x=c[1],a[i].y=c[2],a[i].z=c[3],a[i].qw=i;
    }
    sort(a+1,a+n+1,cmp);
    FOR(i,1,n-1)
    {
        if(a[i].y==a[i+1].y&&a[i].z==a[i+1].z)
        {
            q=min(a[i].y,a[i].x+a[i+1].x);
            if(q>s2)  s2=q,z=a[i].qw,y=a[i+1].qw;
        }
    }
    if(s1>=s2)   cout<<1<<endl<<x<<endl;
    else  cout<<2<<endl<<y<<" "<<z<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
//printf("%.12lf\n",mid);
// __builtin_popcount(int) count 1's in binary
int mod;

int mymod(int num){
  if (num< 0){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

double eps = .0000000001;

int main ()
{
  prep ();
  int n;
  cin >> n;
  map<pair<int, int>, pair<int, int> > vals;
  int maxrad= 0;
  int many = 0;
  int maxx = 0;
  int maxy = 0;
  for (int i=0; i<n; i++){
      int a, b, c;
      cin >> a >> b >> c;
      pair<int, int> p1 = {min(a, b), max(a, b)};
      pair<int, int> p2 = {min(a, c), max(a, c)};
      pair<int, int> p3 = {min(c, b), max(c, b)};
      auto maxval1 = vals.find(p1);
      if (min(a, min(b, c)) > maxrad){
          maxrad = min(a, min(b, c));
          many = 1;
          maxx = i;
      }
      if (maxval1 == vals.end()){
          vals[p1] = {c, i};
      }else{
          pair<int, int> thiss = maxval1->second;
          int thismaxx = min(thiss.first+c, min(a, b));
          if (thismaxx > maxrad){
              maxrad = thismaxx;
              maxx = thiss.second;
              maxy = i;
              many= 2;
          }
          if (c > thiss.first){
              vals[p1] = {c, i};
          }
      }

      maxval1 = vals.find(p2);
      if (maxval1 == vals.end()){
          vals[p2] = {b, i};

      }else{
          pair<int, int> thiss = maxval1->second;
          int thismaxx = min(thiss.first+b, min(a, c));
          if (thismaxx > maxrad){
              maxrad = thismaxx;
              maxx = thiss.second;
              maxy = i;
              many= 2;
          }
          if (b > thiss.first){
              vals[p3] = {b, i};
          }
      }
      maxval1 = vals.find(p3);
      if (maxval1 == vals.end()){
          vals[p3] = {a, i};

      }else{
          pair<int, int> thiss = maxval1->second;
          int thismaxx = min(thiss.first+a, min(b, c));
          if (thismaxx > maxrad){
              maxrad = thismaxx;
              maxx = thiss.second;
              maxy = i;
              many= 2;
          }
          if (a > thiss.first){
              vals[p3] = {a, i};
          }
      }
  }
  cout << many << endl;
  cout << maxx+1 << " ";
  if (many == 2){
      cout << maxy+1;
  }
  return 0;
}
// in dp problems think: up until here, intervals, or "what if there's 1, 2, 3..."
// in math problems write out equations
// also in math problems to change multiplication/division to addition/subtraction use logs, add/subtract something to make the multiplication easier (like if it's 3*f(x)+2, change it to 3*(f(x)+1)-1)
// if printint pow function, put an (int) or (long long) next to it
// if checked everything check for bugs (like sorting wrong way or not putting a break in a loop)
// if n is 10^7 try brute force if the operations are simple
// if can't do dp do brute force/greedy
// to save time don't copy maps/vectors into variables if it already exists
// only use long long if need to
// if wrong on decimal problem, check if program rounds or if you can round to a certain amt of decimals
// if decimals too, if can subtract instead of divide
// in grid traversal problems check if doing sideways or not
// if TLE try to take away loop
// in recursion looking math problems look at things from the point of view of both sides (the start and the end sections of the recursion)
// think about how many possible answers there are to the problem
// try to set the answer to the problem and see if it's possible (like w/ binary search)
// if it makes it easier use +1 indexing
// think twice when writing things down that you're going to use later
// for conversions think if you can compute them w/ only one conversion
// if the problem involves two things moving at the same time, see if you can generalise it to just one thing moving (590/B) (1117/C)
// if nt think primes
// see if you can do a pattern of steps to achieve something (1148/C) (1119/C)
// for problems where you're searching for like a pair that requires something, if it's a yes/no prob, don't focus on individual elements if it's too long (593/B)
// if sub-interval requirements, try to reduce problem into prefix array problem (pairwise numbers) (1174/D)
// think from the end of the problem (if this is the result, what is an attribute of it?)


#include <bits/stdc++.h>

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
//printf("%.12lf\n",mid);
// __builtin_popcount(int) count 1's in binary
int mod;

int mymod(int num){
  if (num< 0){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

double eps = .0000000001;
map<pair<int, int>, pair<int, int> > vals;

int maxrad= 0;
int many = 0;
int maxx = 0;
int maxy = 0;
void thefunc(pair<int, int> p, int c, int i){
    auto maxval1 = vals.find(p);

      if (maxval1 == vals.end()){
          vals[p] = {c, i};
      }else{
          pair<int, int> thiss = maxval1->second;
          int thismaxx = min(thiss.first+c, min(p.first, p.second));

          if (thismaxx > maxrad){
              maxrad = thismaxx;
              maxx = thiss.second;
              maxy = i;
              many= 2;
          }
          if (c > thiss.first){
              vals[p] = {c, i};
          }
      }
}
int main ()
{
  prep ();
  int n;
  cin >> n;

  for (int i=0; i<n; i++){
      int a, b, c;
      cin >> a >> b >> c;
      pair<int, int> p1 = {min(a, b), max(a, b)};
      pair<int, int> p2 = {min(a, c), max(a, c)};
      pair<int, int> p3 = {min(c, b), max(c, b)};
      if (min(a, min(b, c)) > maxrad){
          maxrad = min(a, min(b, c));
          many = 1;
          maxx = i;
      }
      thefunc(p1, c, i);
      thefunc(p2, b, i);
      thefunc(p3, a, i);

  }
  cout << many << endl;
  cout << maxx+1 << " ";
  if (many == 2){
      cout << maxy+1;
  }
  return 0;
}
// in dp problems think: up until here, intervals, or "what if there's 1, 2, 3..."
// in math problems write out equations
// also in math problems to change multiplication/division to addition/subtraction use logs, add/subtract something to make the multiplication easier (like if it's 3*f(x)+2, change it to 3*(f(x)+1)-1)
// if printint pow function, put an (int) or (long long) next to it
// if checked everything check for bugs (like sorting wrong way or not putting a break in a loop)
// if n is 10^7 try brute force if the operations are simple
// if can't do dp do brute force/greedy
// to save time don't copy maps/vectors into variables if it already exists
// only use long long if need to
// if wrong on decimal problem, check if program rounds or if you can round to a certain amt of decimals
// if decimals too, if can subtract instead of divide
// in grid traversal problems check if doing sideways or not
// if TLE try to take away loop
// in recursion looking math problems look at things from the point of view of both sides (the start and the end sections of the recursion)
// think about how many possible answers there are to the problem
// try to set the answer to the problem and see if it's possible (like w/ binary search)
// if it makes it easier use +1 indexing
// think twice when writing things down that you're going to use later
// for conversions think if you can compute them w/ only one conversion
// if the problem involves two things moving at the same time, see if you can generalise it to just one thing moving (590/B) (1117/C)
// if nt think primes
// see if you can do a pattern of steps to achieve something (1148/C) (1119/C)
// for problems where you're searching for like a pair that requires something, if it's a yes/no prob, don't focus on individual elements if it's too long (593/B)
// if sub-interval requirements, try to reduce problem into prefix array problem (pairwise numbers) (1174/D)
// think from the end of the problem (if this is the result, what is an attribute of it?)
// if repeating action, if good for debugging use function


#include <bits/stdc++.h>

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
//printf("%.12lf\n",mid);
// __builtin_popcount(int) count 1's in binary
int mod;

int mymod(int num){
  if (num< 0){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

double eps = .0000000001;

int main ()
{
  prep ();
  int n;
  cin >> n;

  set<pair<int, int> > pairs;
  map<pair<int, int> , pair<pair<int, int>, pair<int, int> > > vals;

  vector<pair<pair<int, int>, int> > regular;
  for (int i=0; i<n; i++){
      int a, b, c;
      cin >> a >> b >> c;
      regular.push_back({{a, b}, c});
      int minac = min(a, c);
      int maxac = max(a, c);
      int minab = min(a, b);
      int maxab = max(a, b);
      int minbc = min(b, c);
      int maxbc = max(b, c);
      pair<int, int> one = {minab, maxab};
      pair<int, int> two = {minac, maxac};
      pair<int, int> three = {minbc, maxbc};
      bool shoulda = false;
      bool shouldb = false;
      bool shouldc = false;
      pairs.insert(one);
      pairs.insert(two);
      pairs.insert(three);
      if (a == b && a == c){
        shoulda = true;
      }else if (a == b){
          shoulda = true;
          shouldb = true;
      }else if (b == c){
         shoulda = true;
         shouldc = true;
      }else{
          shoulda = true;
          shouldb = true;
          shouldc = true;
      }
      auto curval = vals.find(one);
      if (shoulda){
        if (curval == vals.end()){
            vals[one] = {{c, i}, {-1, -1}};
        }else{
            pair<pair<int, int>, pair<int, int> > thiss = curval->second;
            if (c > thiss.first.first){
               pair<int, int> temp = thiss.first;
               thiss.first = {c, i};
               thiss.second = temp;

            }else if (c > thiss.second.first){
                thiss.second = {c, i};

            }
            vals[one] = thiss;
        }
      }
      if (shouldc){
          auto curval = vals.find(three);
            if (curval == vals.end()){
                vals[three] = {{a, i}, {-1, -1}};
            }else{
                pair<pair<int, int>, pair<int, int> > thiss = curval->second;
                if (a > thiss.first.first){
                   pair<int, int> temp = thiss.first;
                   thiss.first = {a, i};
                   thiss.second = temp;

                }else if (a > thiss.second.first){
                    thiss.second = {a, i};
                }
                vals[three] = thiss;
            }
      }
        if (shouldb){
            curval = vals.find(two);
            if (curval == vals.end()){
                vals[two] = {{b, i}, {-1, -1}};
            }else{
                pair<pair<int, int>, pair<int, int> > thiss = curval->second;
                if (b > thiss.first.first){
                   pair<int, int> temp = thiss.first;
                   thiss.first = {b, i};
                   thiss.second = temp;

                }else if (b > thiss.second.first){
                    thiss.second = {b, i};
                }
                vals[two] = thiss;
            }
        }

  }
  int maxrad = 0;
  int maxx = -1;
  int maxy = -1;
  int many = 0;
  for (pair<int, int> p : pairs){
      pair<pair<int, int>, pair<int, int> > sett = vals.find(p)->second;

      int myrad = 0;
      int curmany = 0;
      if (sett.second.first == -1){
          curmany = 1;
          myrad = min(sett.first.first, min(p.first, p.second));
      }else{
          curmany = 2;
          myrad = min(sett.first.first+sett.second.first, min(p.first, p.second));
      }
      if (myrad > maxrad){
          maxrad = myrad;
          many = curmany;
          maxx = sett.first.second;
          if (many > 1){
              maxy = sett.second.second;
          }
      }
  }

  cout << many << endl;
  cout << maxx+1 << " ";
  if (many != 1){
      cout << maxy+1;
  }
  return 0;
}
// in dp problems think: up until here, intervals, or "what if there's 1, 2, 3..."
// in math problems write out equations
// also in math problems to change multiplication/division to addition/subtraction use logs, add/subtract something to make the multiplication easier (like if it's 3*f(x)+2, change it to 3*(f(x)+1)-1)
// if printint pow function, put an (int) or (long long) next to it
// if checked everything check for bugs (like sorting wrong way or not putting a break in a loop)
// if n is 10^7 try brute force if the operations are simple
// if can't do dp do brute force/greedy
// to save time don't copy maps/vectors into variables if it already exists
// only use long long if need to
// if wrong on decimal problem, check if program rounds or if you can round to a certain amt of decimals
// if decimals too, if can subtract instead of divide
// in grid traversal problems check if doing sideways or not
// if TLE try to take away loop
// in recursion looking math problems look at things from the point of view of both sides (the start and the end sections of the recursion)
// think about how many possible answers there are to the problem
// try to set the answer to the problem and see if it's possible (like w/ binary search)
// if it makes it easier use +1 indexing
// think twice when writing things down that you're going to use later
// for conversions think if you can compute them w/ only one conversion
// if the problem involves two things moving at the same time, see if you can generalise it to just one thing moving (590/B) (1117/C)
// if nt think primes
// see if you can do a pattern of steps to achieve something (1148/C) (1119/C)
// for problems where you're searching for like a pair that requires something, if it's a yes/no prob, don't focus on individual elements if it's too long (593/B)
// if sub-interval requirements, try to reduce problem into prefix array problem (pairwise numbers) (1174/D)
// think from the end of the problem (if this is the result, what is an attribute of it?)