#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;
struct triple{
    int first;
    int second;
    int third;
};

int main ()
{
  prep ();
  int n;
  cin >> n;
  vector<triple> v;
  set<pair<int, int> > first2;
  set<pair<int, int> > firstthird;
  set<pair<int, int> > secondthird;
  map<pair<int, int> , pair<pair<int, int>, pair<int, int> > > valsfirst2;
  map<pair<int, int> , pair<pair<int, int>, pair<int, int> > > valsfirstthird;
  map<pair<int, int> , pair<pair<int, int>, pair<int, int> > > valssecondthird;
  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};
      first2.insert(one);
      firstthird.insert(two);
      secondthird.insert(three);
      auto onetwo = valsfirst2.find(one);
      auto onethree = valsfirstthird.find(two);
      auto twothree = valssecondthird.find(three);
      if (onetwo != valsfirst2.end()){
          pair<pair<int, int>, pair<int, int> > thisval = onetwo->second;
          if (c > thisval.first.first){
              pair<int, int> temp = thisval.first;
              thisval.first = {c, i};
              thisval.second = temp;
          }else if (c > thisval.second.first){
              thisval.second = {c, i};
          }
          valsfirst2[one] = thisval;
      }else{
          valsfirst2[one] = {{c, i}, {-1, -1}};
      }
      if (onethree != valsfirstthird.end()){
          pair<pair<int, int>, pair<int, int> > thisval = onethree->second;
          if (b > thisval.first.first){
              pair<int, int> temp = thisval.first;
              thisval.first = {b, i};
              thisval.second = temp;
          }else if (b > thisval.second.first){
              thisval.second = {b, i};
          }
          valsfirstthird[two] = thisval;
      }else{
          valsfirstthird[two] = {{b, i}, {-1, -1}};
      }
      if (twothree != valssecondthird.end()){
          pair<pair<int, int>, pair<int, int> > thisval = twothree->second;
          if (a > thisval.first.first){
              pair<int, int> temp = thisval.first;
              thisval.first = {a, i};
              thisval.second = temp;
          }else if (a > thisval.second.first){
              thisval.second = {a, i};
          }
          valssecondthird[three] = thisval;
      }else{
          valssecondthird[three] = {{a, i}, {-1, -1}};
      }
  }
  int many = -1;
  int maxx = -1;
  int maxy = -1;
  double maxrad = 0;
  for (pair<int, int> p : first2){
      pair<pair<int, int>, pair<int, int> > findd = valsfirst2.find(p)->second;
      double rad = 0;
      int manycur = 1;
      if (findd.second.first == -1){
          rad = (double)min(findd.first.first, min(p.first, p.second));
      }else{
          manycur = 2;
          rad = (double)min(findd.first.first+findd.second.first, min(p.first, p.second));
      }
      if (isgreater(rad, maxrad)){
          maxrad = rad;
          if (manycur == 1){
              maxx = findd.first.second;
              many = manycur;
          }else{
              maxx = findd.first.second;
              maxy = findd.second.second;
              many = manycur;
          }
      }
  }

  for (pair<int, int> p : firstthird){
      pair<pair<int, int>, pair<int, int> > findd = valsfirstthird.find(p)->second;
      double rad = 0;
      int manycur = 1;
      if (findd.second.first == -1){
          rad = (double)min(findd.first.first, min(p.first, p.second));
      }else{
          manycur = 2;
          rad = (double)min(findd.first.first+findd.second.first, min(p.first, p.second));
      }
      if (isgreater(rad, maxrad)){
          maxrad = rad;
          if (manycur == 1){
              maxx = findd.first.second;
              many = manycur;
          }else{
              maxx = findd.first.second;
              maxy = findd.second.second;
              many = manycur;
          }
      }
  }
  for (pair<int, int> p : secondthird){
      pair<pair<int, int>, pair<int, int> > findd = valssecondthird.find(p)->second;
      double rad = 0;
      int manycur = 1;
      if (findd.second.first == -1){
          rad = (double)min(findd.first.first, min(p.first, p.second));
      }else{
          manycur = 2;
          rad = (double)min(findd.first.first+findd.second.first, min(p.first, p.second));
      }
      if (isgreater(rad, maxrad)){
          maxrad = rad;
          if (manycur == 1){
              maxx = findd.first.second;
              many = manycur;
          }else{
              maxx = findd.first.second;
              maxy = findd.second.second;
              many = manycur;
          }
      }
  }
  for (int i=0; i<n; i++){
      int a = regular[i].first.first;
      int b = regular[i].first.second;
      int c = regular[i].second;
      double rad = (double)min(a, min(b, c));
      if (isgreater(rad, maxrad)){
          maxrad = rad;
          many = 1;
          maxx = i;
      }
  }
  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)


#include<bits/stdc++.h>
using namespace std;
struct str
{
	int a,b,c;
}d[100010];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int i,n,m,M,index,y,z,coun=1;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>d[i].a>>d[i].b>>d[i].c;
		m=min(d[i].a,min(d[i].b,d[i].c));
		if(m>M)
		{
			M=m;
			index=i;
		}
		if(d[i].a<d[i].b)
		swap(d[i].a,d[i].b);
		if(d[i].a<d[i].c)
       swap(d[i].a,d[i].c);
	   if(d[i].b<d[i].c)
	   swap(d[i].b,d[i].c);
	}
	for(i=1;i<n;i++)
	{
		for(int j=i+1;j<=n;j++)
    {
    	if(d[i].a==d[j].a&&d[i].b==d[j].b&&d[i].c==d[j].c)
    	{
    		coun=2;
			M=d[i].c;
			y=i,z=j;
		}
	  else if(d[i].a==d[j].a&&d[i].b==d[j].b)
	  {
	  	int s=min(d[i].a,min(d[i].b,d[i].c+d[j].c));
	  	if(M<s)
	  	{
	  		M=s;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	  else if(d[i].b==d[j].b&&d[i].c==d[j].c)
	  {
	  	int v=min(d[i].b,min(d[i].c,d[i].a+d[j].a));
	  	if(M<v)
	  	{
	  		M=v;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	  else if(d[i].a==d[j].a&&d[i].c==d[j].c)
	  {
	  	int l=min(d[i].a,min(d[i].c,d[i].b+d[j].b));
	  	if(M<l)
	  	{
	  		M=l;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	}
		}
		if(coun==1)
		{
			cout<<coun<<endl;
			cout<<index<<endl;
		}
		else
	  {
	  	cout<<coun<<endl;
	  	cout<<y<<" "<<z<<endl;
	  }
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct str
{
	int a,b,c;
}d[100010];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int i,n,m,M,index,y,z,coun=1;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>d[i].a>>d[i].b>>d[i].c;
		m=min(d[i].a,min(d[i].b,d[i].c));
		if(m>M)
		{
			M=m;
			index=i;
		}
		if(d[i].a<d[i].b)
		swap(d[i].a,d[i].b);
		if(d[i].a<d[i].c)
       swap(d[i].a,d[i].c);
	   if(d[i].b<d[i].c)
	   swap(d[i].b,d[i].c);
	}
	for(i=1;i<n;i++)
	{
		for(int j=i+1;j<=n;j++)
    {
	  if(d[i].a==d[j].a&&d[i].b==d[j].b)
	  {
	  	int s=min(d[i].a,min(d[i].b,d[i].c+d[j].c));
	  	if(M<s)
	  	{
	  		M=s;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	  else if(d[i].b==d[j].b&&d[i].c==d[j].c)
	  {
	  	int v=min(d[i].b,min(d[i].c,d[i].a+d[j].a));
	  	if(M<v)
	  	{
	  		M=v;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	  else if(d[i].a==d[j].a&&d[i].c==d[j].c)
	  {
	  	int l=min(d[i].a,min(d[i].c,d[i].b+d[j].b));
	  	if(M<l)
	  	{
	  		M=l;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	}
		}
		if(coun==1)
		{
			cout<<coun<<endl;
			cout<<index<<endl;
		}
		else
	  {
	  	cout<<coun<<endl;
	  	cout<<y<<" "<<z<<endl;
	  }
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10;
typedef long long ll;
struct ss {
    ll x , y , z , num;
}s[M];
bool cmp(ss a , ss b) {
    if(a.x == b.x)
        return a.y > b.y;
    return a.x > b.x;
}
int main()
{
    int n;
    cin >> n;
    ll MAX = 0;
    int temp = 0;
    for(int i = 0 ; i < n ; i++) {
        ll a , b , c;
        cin >> a >> b >> c;
        ll sum = a + b + c;
        s[i].x = max(a , max(b , c));
        s[i].z = min(a , min(b , c));
        s[i].y = (sum - s[i].x - s[i].z);
        s[i].num = i;
        if(MAX < s[i].z) {
            temp = i;
            MAX = s[i].z;
        }
    }
    sort(s , s + n , cmp);
    ll sum2 = 0;
    int l = 0;
    int r = l;
    int l2 = l;
    for(int i = 0 ; i < n - 1 ; i++) {
        if(s[i].x == s[i + 1].x && s[i].y == s[i + 1].y) {
            l = i;
            sum2 = s[i].z + s[i + 1].z;
            if(MAX < min(sum2 , s[i].y)) {
                MAX = min(sum2 , s[i].y);
                r = i + 1;
                l2 = l;
            }
        }
    }
    if(r - l2 >= 1) {
        cout << r - l2 + 1 << endl;
        for(int i = l2 ; i <= r ; i++) {
            cout << s[i]. num + 1 << ' ';
        }
    }
    else {
        cout << 1 << endl;
        cout << temp + 1 << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct str
{
	int a,b,c;
}d[100010];
int main()
{
	int i,n,m,M,index,y,z,coun=1;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>d[i].a>>d[i].b>>d[i].c;
		m=min(d[i].a,min(d[i].b,d[i].c));
		if(m>M)
		{
			M=m;
			index=i;
		}
		if(d[i].a<d[i].b)
		swap(d[i].a,d[i].b);
		if(d[i].a<d[i].c)
       swap(d[i].a,d[i].c);
	   if(d[i].b<d[i].c)
	   swap(d[i].b,d[i].c);
	}
	for(i=1;i<n;i++)
	{
		for(int j=i+1;j<=n;j++)
    {
	  if(d[i].a==d[j].a&&d[i].b==d[j].b)
	  {
	  	int s=min(d[i].a,min(d[i].b,d[i].c+d[j].c));
	  	if(M<s)
	  	{
	  		M=s;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	  else if(d[i].b==d[j].b&&d[i].c==d[j].c)
	  {
	  	int v=min(d[i].b,min(d[i].c,d[i].a+d[j].a));
	  	if(M<v)
	  	{
	  		M=v;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	  else if(d[i].a==d[j].a&&d[i].c==d[j].c)
	  {
	  	int l=min(d[i].a,min(d[i].c,d[i].b+d[j].b));
	  	if(M<l)
	  	{
	  		M=l;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	}
		}
		if(coun==1)
		{
			cout<<coun<<endl;
			cout<<index<<endl;
		}
		else
	  {
	  	cout<<coun<<endl;
	  	cout<<y<<" "<<z<<endl;
	  }
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct str
{
	int a,b,c;
}d[100010];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int i,n,m,M,index,y,z,coun=1;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>d[i].a>>d[i].b>>d[i].c;
		m=min(d[i].a,min(d[i].b,d[i].c));
		if(m>M)
		{
			M=m;
			index=i;
		}
		if(d[i].a<d[i].b)
		swap(d[i].a,d[i].b);
		if(d[i].a<d[i].c)
       swap(d[i].a,d[i].c);
	   if(d[i].b<d[i].c)
	   swap(d[i].b,d[i].c);
	}
	for(i=1;i<n;i++)
	{
		for(int j=i+1;j<=n;j++)
    {
    	if(d[i].a==d[j].a&&d[i].b==d[j].b&&d[i].c==d[j].c)
    	{
    		coun=2;
			M=d[i].a;
			y=i,z=j;
		}
	  else if(d[i].a==d[j].a&&d[i].b==d[j].b)
	  {
	  	int s=min(d[i].a,min(d[i].b,d[i].c+d[j].c));
	  	if(M<s)
	  	{
	  		M=s;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	  else if(d[i].b==d[j].b&&d[i].c==d[j].c)
	  {
	  	int v=min(d[i].b,min(d[i].c,d[i].a+d[j].a));
	  	if(M<v)
	  	{
	  		M=v;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	  else if(d[i].a==d[j].a&&d[i].c==d[j].c)
	  {
	  	int l=min(d[i].a,min(d[i].c,d[i].b+d[j].b));
	  	if(M<l)
	  	{
	  		M=l;
	  		y=i,z=j;
	  		coun=2;
		  }
	  }
	}
		}
		if(coun==1)
		{
			cout<<coun<<endl;
			cout<<index<<endl;
		}
		else
	  {
	  	cout<<coun<<endl;
	  	cout<<y<<" "<<z<<endl;
	  }
	return 0;
}


#include<bits/stdc++.h>//前面用了两个for循环tle了
using namespace std;
#define ll long long
struct str{
	ll l,mid,r,id;
}a[100010];
bool cmp(str p,str q)
{
	if(p.r==q.r)
	{
		if(p.mid==q.mid)
		{
			return p.l<q.l;
		}
		else
		return p.mid<q.mid;
	}
	else
	return p.r<q.r;

}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,i,id1,id2,c,te,coun;
	ll b[4];
	while(cin>>n)
	{
		c=0;
		coun=1;
		for(i=1;i<n+1;i++)
		{
			cin>>a[i].l>>a[i].mid>>a[i].r;
			a[i].id=i;
			b[0]=a[i].l;
			b[1]=a[i].mid;
			b[2]=a[i].r;
			sort(b,b+3);
			a[i].l=b[0];
			a[i].mid=b[1];
			a[i].r=b[2];
			if(a[i].l>c)
			{
				c=a[i].l;
				te=a[i].id;
			}
		}
		sort(a+1,a+n+1,cmp);
		for(i=2;i<n+1;i++)
		{
			if(a[i].r==a[i-1].r&&a[i].mid==a[i-1].mid)
			{
				if(c<min(a[i].l+a[i-1].l,min(a[i].mid,a[i].r)))
				{
					c=min(a[i].l+a[i-1].l,min(a[i].mid,a[i].r));
					id1=a[i].id;
					id2=a[i-1].id;
					coun=2;
				}
			}
		}
		if(coun==2)
		{
			cout<<coun<<endl;
			cout<<id1<<' '<<id2<<endl;
		}
		else
		{
			cout<<coun<<endl;
			cout<<te<<endl;
		}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d,b1,c1,d1,v,h;
pair<pll,pll> a[100002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        if(a[i].first.second<a[i].first.first)swap(a[i].first.second,a[i].first.first);
        if(a[i].second.first<a[i].first.first)swap(a[i].second.first,a[i].first.first);
        if(a[i].second.first<a[i].first.second)swap(a[i].second.first,a[i].first.second);
        if(a[i].first.first>ma)
        {
            ma=a[i].first.first;
            k=1;
            rez=i+1;

        }
    }
    sort(a,a+n);
    //for(i=0; i<n; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            b=a[i].first.first;
            b1=a[j].first.first;
            c=a[i].first.second;
            c1=a[j].first.second;
            d=a[i].second.first;
            d1=a[j].second.first;
            if(b<b1 && c<c1 && d<d1)break;
            if(b==b1 && c==c1)
            {
                v=d+d1;
                v=min(v,b);
                v=min(v,c);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(b==b1 && d==d1)
            {
                v=c+c1;
                v=min(v,b);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

            if(c==c1 && d==d1)
            {
                v=b1+b;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d,b1,c1,d1,v;
pair<pll,pll> a[100002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        if(a[i].first.second<a[i].first.first)swap(a[i].first.second,a[i].first.first);
        if(a[i].second.first<a[i].first.first)swap(a[i].second.first,a[i].first.first);
        if(a[i].second.first<a[i].first.second)swap(a[i].second.first,a[i].first.second);
        if(a[i].first.first>ma)
        {
            ma=a[i].first.first;
            k=1;
            rez=i+1;

        }
    }
    sort(a,a+n);
    //for(i=0; i<n; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            b=a[i].first.first;
            b1=a[j].first.first;
            c=a[i].first.second;
            c1=a[j].first.second;
            d=a[i].second.first;
            d1=a[j].second.first;
            if(b<b1 && c<c1 && d<d1)break;
            if(b==b1 && c==c1)
            {
                v=d+d1;
                v=min(v,b);
                v=min(v,c);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(b==b1 && d==d1)
            {
                v=c+c1;
                v=min(v,b);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(c==c1 && d==d1)
            {
                v=b+b1;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(c==d1 && d==c1)
            {
                v=b+b1;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d,b1,c1,d1,v,h;
pair<pll,pll> a[700002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    v=n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        b=a[i].first.first;
        c=a[i].first.second;
        d=a[i].second.first;
        h=min(b,c);
        h=min(h,d);
        if(h>ma)
        {
            ma=h;
            k=1;
            rez=i+1;
        }
        a[v].first.first=b;
        a[v].first.second=d;
        a[v].second.first=c;
        a[v].second.second=i+1;
        v++;
        a[v].first.first=c;
        a[v].first.second=d;
        a[v].second.first=b;
        a[v].second.second=i+1;
        v++;
        a[v].first.first=c;
        a[v].first.second=b;
        a[v].second.first=d;
        a[v].second.second=i+1;
        v++;
        a[v].first.first=d;
        a[v].first.second=b;
        a[v].second.first=c;
        a[v].second.second=i+1;
        v++;
        a[v].first.first=d;
        a[v].first.second=c;
        a[v].second.first=b;
        a[v].second.second=i+1;
        v++;
    }

    sort(a,a+v);
   // for(i=0; i<v; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<v-1; i++)
    {
        b=a[i].first.first;
        b1=a[i+1].first.first;
        c=a[i].first.second;
        c1=a[i+1].first.second;
        d=a[i].second.first;
        d1=a[i+1].second.first;
        if(b==b1 && c==c1)
        {
            h=d+d1;
            h=min(h,b);
            h=min(h,c);
            if(h>ma)
            {
                ma=h;
                k=2;
                rez=a[i].second.second;
                rez1=a[i+1].second.second;
            }
        }
        if(b==b1 && d==d1)
        {
            h=c+c1;
            h=min(h,b);
            h=min(h,d);
            if(h>ma)
            {
                ma=h;
                k=2;
                rez=a[i].second.second;
                rez1=a[i+1].second.second;
            }
        }

        if(c==c1 && d==d1)
        {
            h=b1+b;
            h=min(h,c);
            h=min(h,d);
            if(h>ma)
            {
                ma=h;
                k=2;
                rez=a[i].second.second;
                rez1=a[i+1].second.second;
            }
        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)
        cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d,b1,c1,d1,v;
pair<pll,pll> a[100002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        if(a[i].first.second<a[i].first.first)swap(a[i].first.second,a[i].first.first);
        if(a[i].second.first<a[i].first.first)swap(a[i].second.first,a[i].first.first);
        if(a[i].second.first<a[i].first.second)swap(a[i].second.first,a[i].first.second);
        if(a[i].first.first>ma)
        {
            ma=a[i].first.first;
            k=1;
            rez=i+1;

        }
    }
    sort(a,a+n);
    //for(i=0; i<n; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            b=a[i].first.first;
            b1=a[j].first.first;
            c=a[i].first.second;
            c1=a[j].first.second;
            d=a[i].second.first;
            d1=a[j].second.first;
            if(b<b1 && c<c1 && d<d1)break;
            if(b==b1 && c==c1)
            {
                v=d+d1;
                v=min(v,b);
                v=min(v,c);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(b==b1 && d==d1)
            {
                v=c+c1;
                v=min(v,b);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(b==b1 && d==c1)
            {
                v=d1+c;
                v=min(v,b);
                v=min(v,c1);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
             if(b==b1 && d1==c)
            {
                v=d+c1;
                v=min(v,b);
                v=min(v,d1);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(c==c1 && d==d1)
            {
                v=b1+b;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(c==c1 && d==b1)
            {
                v=d1+b;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(c==c1 && d1==b)
            {
                v=d+b1;
                v=min(v,c);
                v=min(v,d1);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(d==d1 && b==c1)
            {
                v=b1+c;
                v=min(v,c1);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
             if(d==d1 && b1==c)
            {
                v=b+c1;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d,b1,c1,d1,v;
pair<pll,pll> a[100002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        if(a[i].first.second<a[i].first.first)swap(a[i].first.second,a[i].first.first);
        if(a[i].second.first<a[i].first.first)swap(a[i].second.first,a[i].first.first);
        if(a[i].second.first<a[i].first.second)swap(a[i].second.first,a[i].first.second);
        if(a[i].first.first>ma)
        {
            ma=a[i].first.first;
            k=1;
            rez=i+1;

        }
    }
    sort(a,a+n);
    //for(i=0; i<n; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            b=a[i].first.first;
            b1=a[j].first.first;
            c=a[i].first.second;
            c1=a[j].first.second;
            d=a[i].second.first;
            d1=a[j].second.first;
            if(b<b1 && c<c1 && d<d1)break;
            if(b==b1 && c==c1)
            {
                v=d+d1;
                v=min(v,b);
                v=min(v,c);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(b==b1 && d==d1)
            {
                v=c+c1;
                v=min(v,b);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

            if(c==c1 && d==d1)
            {
                v=b1+b;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d;
pair<pll,pll> a[100002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        if(a[i].first.second<a[i].first.first)swap(a[i].first.second,a[i].first.first);
        if(a[i].second.first<a[i].first.first)swap(a[i].second.first,a[i].first.first);
        if(a[i].second.first<a[i].first.second)swap(a[i].second.first,a[i].first.second);
        if(a[i].first.first>ma)
        {
            ma=a[i].first.first;
            k=1;
            rez=i+1;

        }
    }
    sort(a,a+n);
    //for(i=0; i<n; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            //if(a[i].first.first!=a[j].first.first && a[i].first.second!=a[j].first.second && a[i].second.first!=a[j].second.first)break;
            if(a[i].first.first==a[j].first.first && a[i].first.second==a[j].first.second)
            {
                b=a[i].first.first;
                c=a[i].first.second;
                d=a[i].second.first+a[j].second.first;
                b=min(b,c);
                b=min(b,d);
                if(b>ma)
                {
                    ma=b;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(a[i].first.first==a[j].first.first && a[i].second.first==a[j].second.first)
            {
                b=a[i].first.first;
                c=a[i].second.first;
                d=a[i].first.second+a[j].first.second;
                b=min(b,c);
                b=min(b,d);
                if(b>ma)
                {
                    ma=b;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(a[i].first.second==a[j].first.second && a[i].second.first==a[j].second.first)
            {
                b=a[i].first.second;
                c=a[i].second.first;
                d=a[i].first.first+a[j].first.first;
                b=min(b,c);
                b=min(b,d);
                if(b>ma)
                {
                    ma=b;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d,b1,c1,d1,v;
pair<pll,pll> a[100002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        if(a[i].first.second<a[i].first.first)swap(a[i].first.second,a[i].first.first);
        if(a[i].second.first<a[i].first.first)swap(a[i].second.first,a[i].first.first);
        if(a[i].second.first<a[i].first.second)swap(a[i].second.first,a[i].first.second);
        if(a[i].first.first>ma)
        {
            ma=a[i].first.first;
            k=1;
            rez=i+1;

        }
    }
    sort(a,a+n);
    //for(i=0; i<n; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            b=a[i].first.first;
            b1=a[j].first.first;
            c=a[i].first.second;
            c1=a[j].first.second;
            d=a[i].second.first;
            d1=a[j].second.first;
            if(b<b1)break;
            if(b==b1 && c==c1)
            {
                v=d+d1;
                v=min(v,b);
                v=min(v,c);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(b==b1 && d==d1)
            {
                v=c+c1;
                v=min(v,b);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

            if(c==c1 && d==d1)
            {
                v=b1+b;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d,b1,c1,d1,v,h;
pair<pll,pll> a[700002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    v=n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        b=a[i].first.first;
        c=a[i].first.second;
        d=a[i].second.first;
        h=min(b,c);
        h=min(h,d);
        if(h>ma)
        {
            ma=h;
            k=1;
            rez=i+1;
        }
        a[v].first.first=b;
        a[v].first.second=d;
        a[v].second.first=c;
        a[v].second.second=i+1;
        v++;
        a[v].first.first=c;
        a[v].first.second=d;
        a[v].second.first=b;
        a[v].second.second=i+1;
        v++;
        a[v].first.first=c;
        a[v].first.second=b;
        a[v].second.first=d;
        a[v].second.second=i+1;
        v++;
        a[v].first.first=d;
        a[v].first.second=b;
        a[v].second.first=c;
        a[v].second.second=i+1;
        v++;
        a[v].first.first=d;
        a[v].first.second=c;
        a[v].second.first=b;
        a[v].second.second=i+1;
        v++;
    }

    sort(a,a+v);
   // for(i=0; i<v; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<v-1; i++)
    {
        if(a[i].second.second==a[i+1].second.second)continue;
        b=a[i].first.first;
        b1=a[i+1].first.first;
        c=a[i].first.second;
        c1=a[i+1].first.second;
        d=a[i].second.first;
        d1=a[i+1].second.first;
        if(b==b1 && c==c1)
        {
            h=d+d1;
            h=min(h,b);
            h=min(h,c);
            if(h>ma)
            {
                ma=h;
                k=2;
                rez=a[i].second.second;
                rez1=a[i+1].second.second;
            }
        }
        if(b==b1 && d==d1)
        {
            h=c+c1;
            h=min(h,b);
            h=min(h,d);
            if(h>ma)
            {
                ma=h;
                k=2;
                rez=a[i].second.second;
                rez1=a[i+1].second.second;
            }
        }

        if(c==c1 && d==d1)
        {
            h=b1+b;
            h=min(h,c);
            h=min(h,d);
            if(h>ma)
            {
                ma=h;
                k=2;
                rez=a[i].second.second;
                rez1=a[i+1].second.second;
            }
        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)
        cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d;
pair<pll,pll> a[100002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        if(a[i].first.second<a[i].first.first)swap(a[i].first.second,a[i].first.first);
        if(a[i].second.first<a[i].first.first)swap(a[i].second.first,a[i].first.first);
        if(a[i].second.first<a[i].first.second)swap(a[i].second.first,a[i].first.second);
        if(a[i].first.first>ma)
        {
            ma=a[i].first.first;
            k=1;
            rez=i+1;

        }
    }
    sort(a,a+n);
    //for(i=0; i<n; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            if(a[i].first.first<a[j].first.first && a[i].first.second<a[j].first.second && a[i].second.first<a[j].second.first)break;
            if(a[i].first.first==a[j].first.first && a[i].first.second==a[j].first.second)
            {
                b=a[i].first.first;
                c=a[i].first.second;
                d=a[i].second.first+a[j].second.first;
                b=min(b,c);
                b=min(b,d);
                if(b>ma)
                {
                    ma=b;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(a[i].first.first==a[j].first.first && a[i].second.first==a[j].second.first)
            {
                b=a[i].first.first;
                c=a[i].second.first;
                d=a[i].first.second+a[j].first.second;
                b=min(b,c);
                b=min(b,d);
                if(b>ma)
                {
                    ma=b;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(a[i].first.second==a[j].first.second && a[i].second.first==a[j].second.first)
            {
                b=a[i].first.second;
                c=a[i].second.first;
                d=a[i].first.first+a[j].first.first;
                b=min(b,c);
                b=min(b,d);
                if(b>ma)
                {
                    ma=b;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll i,j,k,ma=-10e10,rez,rez1,n,b,c,d,b1,c1,d1,v;
pair<pll,pll> a[100002];
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second>>a[i].second.first;
        a[i].second.second=i+1;
        if(a[i].first.second<a[i].first.first)swap(a[i].first.second,a[i].first.first);
        if(a[i].second.first<a[i].first.first)swap(a[i].second.first,a[i].first.first);
        if(a[i].second.first<a[i].first.second)swap(a[i].second.first,a[i].first.second);
        if(a[i].first.first>ma)
        {
            ma=a[i].first.first;
            k=1;
            rez=i+1;

        }
    }
    sort(a,a+n);
    //for(i=0; i<n; i++)cout<<a[i].first.first<<" "<<a[i].first.second<<" "<<a[i].second.first<<" "<<a[i].second.second<<endl;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            b=a[i].first.first;
            b1=a[j].first.first;
            c=a[i].first.second;
            c1=a[j].first.second;
            d=a[i].second.first;
            d1=a[j].second.first;
            if(b==b1 && c==c1)
            {
                v=d+d1;
                v=min(v,b);
                v=min(v,c);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(b==b1 && d==d1)
            {
                v=c+c1;
                v=min(v,b);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(b==b1 && d==c1)
            {
                v=d1+c;
                v=min(v,b);
                v=min(v,c1);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
             if(b==b1 && d1==c)
            {
                v=d+c1;
                v=min(v,b);
                v=min(v,d1);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(c==c1 && d==d1)
            {
                v=b1+b;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(c==c1 && d==b1)
            {
                v=d1+b;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(c==c1 && d1==b)
            {
                v=d+b1;
                v=min(v,c);
                v=min(v,d1);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
            if(d==d1 && b==c1)
            {
                v=b1+c;
                v=min(v,c1);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }
             if(d==d1 && b1==c)
            {
                v=b+c1;
                v=min(v,c);
                v=min(v,d);
                if(v>ma)
                {
                    ma=v;
                    k=2;
                    rez=a[i].second.second;
                    rez1=a[j].second.second;
                }
            }

        }
    }
    cout<<k<<endl;
    cout<<rez;
    if(k==2)cout<<" "<<rez1;
    cout<<endl;
    return 0;
}


/*****Because Its Christmas******/
#include<bits/stdc++.h>
using namespace std;
#define lld               long long int
#define ld                long double
#define pb                push_back
#define ppb               pop_back
#define mp                make_pair
#define nl                '\n'
#define all(c)            (c).begin(),(c).end()
#define rall(c)           (c).rbegin(),(c).rend()
#define sz(c)             (c).size()
#define tr(x,a)           for(auto &a : x)
#define psnt(x,a)         (x).find(a)!=(x).end()
#define vpsnt(x,a)        find(all(x),a)!=(x).end()
#define lexichar(x,y)     lexicographical_compare(x,x+strlen(x),y,y+strlen(y)) //modify the ranges
#define lexistr(x,y)      lexicographical_compare(x.begin(),x.end(),y.begin(),y.end())
#define MOD               1000000007
#define pi                3.1415926536
#define tod               1
#define itr(i,a,b)        for(lld i=a;i<=b;i++)
#define itrn(i,a,b)       for(lld i=a;i>=b;i--)
#define iot(n)            for(lld i=0;i<n;i++)
#define pls(n,arr)        lld arr[n]; iot(n)  cin>>arr[i];

typedef pair<lld,lld>     pii;
typedef pair<string,lld>  psi;
template <typename T>
bool mycomp(T x,T y){
   return (x==y);  //give your condition here
}
bool paircomp(const pair<lld,lld> &x,const pair<lld,lld> &y){
return x.second<y.second;
}
int main(){
       ios_base::sync_with_stdio(false);
             cin.tie(0);
            cout.tie(0);
      lld n; cin>>n;
     lld arr[n][3];
     iot(n)  cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
     map<pii,priority_queue<pii> > mpq;

      iot(n){
        lld A1=min(arr[i][0],arr[i][1]),A2=max(arr[i][0],arr[i][1]); //(a,b)
        lld B1=min(arr[i][0],arr[i][2]),B2=max(arr[i][0],arr[i][2]);  //(a,c)
        lld C1=min(arr[i][1],arr[i][2]),C2=max(arr[i][1],arr[i][2]); //(b,c)
        if(arr[i][0]==arr[i][1]&&arr[i][0]==arr[i][2])
        mpq[mp(A1,A2)].push(mp(arr[i][2],i+1));
        else if(arr[i][0]==arr[i][1]&&arr[i][0]!=arr[i][2]){
              mpq[mp(A1,A2)].push(mp(arr[i][2],i+1));
               mpq[mp(B1,B2)].push(mp(arr[i][1],i+1));

        }
        else if(arr[i][0]==arr[i][2]&&arr[i][0]!=arr[i][1]){
             mpq[mp(B1,B2)].push(mp(arr[i][1],i+1));
               mpq[mp(C1,C2)].push(mp(arr[i][0],i+1));
        }
        else if(arr[i][1]==arr[i][2]&&arr[i][1]!=arr[i][0]){
            mpq[mp(C1,C2)].push(mp(arr[i][0],i+1));
             mpq[mp(A1,A2)].push(mp(arr[i][2],i+1));
        }
        else{
             mpq[mp(A1,A2)].push(mp(arr[i][2],i+1));
        mpq[mp(B1,B2)].push(mp(arr[i][1],i+1));
        mpq[mp(C1,C2)].push(mp(arr[i][0],i+1));}
     }
     lld maxer=-1,maxerid,maxerid2,flag=0;
     for(auto &p:mpq){
         if(sz(p.second)==1) {
             pair<lld,lld> tp=p.second.top();
             lld kk=min({p.first.first,p.first.second,tp.first});
             if(kk>maxer){
                 maxer=kk;
                 maxerid=tp.second;
          flag=1;
             }
         }
         else{
             pair<lld,lld> tp1,tp2;
             tp1=p.second.top();
             p.second.pop();
             tp2=p.second.top();
          lld kk=min({p.first.first,p.first.second,tp1.first+tp2.first});
             if(kk>maxer){
                 maxer=kk;
                 maxerid=tp1.second;
                 maxerid2=tp2.second;
                 flag=2;
         }
     }
     }
     if(flag==1)
         cout<<1<<nl<<maxerid<<nl;
     else
        cout<<2<<nl<<maxerid<<" "<<maxerid2<<nl;

}


/*****Because Its Christmas******/
#include<bits/stdc++.h>
using namespace std;
#define lld               long long int
#define ld                long double
#define pb                push_back
#define ppb               pop_back
#define mp                make_pair
#define nl                '\n'
#define all(c)            (c).begin(),(c).end()
#define rall(c)           (c).rbegin(),(c).rend()
#define sz(c)             (c).size()
#define tr(x,a)           for(auto &a : x)
#define psnt(x,a)         (x).find(a)!=(x).end()
#define vpsnt(x,a)        find(all(x),a)!=(x).end()
#define lexichar(x,y)     lexicographical_compare(x,x+strlen(x),y,y+strlen(y)) //modify the ranges
#define lexistr(x,y)      lexicographical_compare(x.begin(),x.end(),y.begin(),y.end())
#define MOD               1000000007
#define pi                3.1415926536
#define tod               1
#define itr(i,a,b)        for(lld i=a;i<=b;i++)
#define itrn(i,a,b)       for(lld i=a;i>=b;i--)
#define iot(n)            for(lld i=0;i<n;i++)
#define pls(n,arr)        lld arr[n]; iot(n)  cin>>arr[i];

typedef pair<lld,lld>     pii;
typedef pair<string,lld>  psi;
template <typename T>
bool mycomp(T x,T y){
   return (x==y);  //give your condition here
}
bool paircomp(const pair<lld,lld> &x,const pair<lld,lld> &y){
return x.second<y.second;
}
int main(){
       ios_base::sync_with_stdio(false);
             cin.tie(0);
            cout.tie(0);
      lld n; cin>>n;
     lld arr[n][3];
     iot(n)  cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
     map<pii,priority_queue<pii> > mpq;
     //(a,b)
     mpq.clear();
     iot(n){
         mpq[mp(arr[i][0],arr[i][1])].push(mp(arr[i][2],i+1));

     }
     lld maxer=-1,maxerid,maxerid2,flag=0;
     for(auto &p:mpq){
         if(sz(p.second)==1) {
             pair<lld,lld> tp=p.second.top();
             lld kk=min({p.first.first,p.first.second,tp.first});
             if(kk>maxer){
                 maxer=kk;
                 maxerid=tp.second;
          flag=1;
             }
         }
         else{
             pair<lld,lld> tp1,tp2;
             tp1=p.second.top();
             p.second.pop();
             tp2=p.second.top();
          lld kk=min({p.first.first,p.first.second,tp1.first+tp2.first});
             if(kk>maxer){
                 maxer=kk;
                 maxerid=tp1.second;
                 maxerid2=tp2.second;
                 flag=2;
         }
     }
     }
     //(a,c)
     mpq.clear();
      iot(n){
         mpq[mp(arr[i][0],arr[i][2])].push(mp(arr[i][1],i+1));

     }
     lld maxerb=-1,maxeridb,maxerid2b,flagb=0;
     for(auto &p:mpq){
         if(sz(p.second)==1) {
             pair<lld,lld> tp=p.second.top();
             lld kk=min({p.first.first,p.first.second,tp.first});
             if(kk>maxerb){
                 maxerb=kk;
                 maxeridb=tp.second;
          flagb=1;
             }
         }
         else{
             pair<lld,lld> tp1,tp2;
             tp1=p.second.top();
             p.second.pop();
             tp2=p.second.top();
          lld kk=min({p.first.first,p.first.second,tp1.first+tp2.first});
             if(kk>maxerb){
                 maxerb=kk;
                 maxeridb=tp1.second;
                 maxerid2b=tp2.second;
                 flagb=2;
         }
     }
     }
     //(b,c)
     mpq.clear();
      iot(n){
         mpq[mp(arr[i][1],arr[i][2])].push(mp(arr[i][0],i+1));

     }
     lld maxerc=-1,maxeridc,maxerid2c,flagc=0;
     for(auto &p:mpq){
         if(sz(p.second)==1) {
             pair<lld,lld> tp=p.second.top();
             lld kk=min({p.first.first,p.first.second,tp.first});
             if(kk>maxerc){
                 maxerc=kk;
                 maxeridc=tp.second;
          flagc=1;
             }
         }
         else{
             pair<lld,lld> tp1,tp2;
             tp1=p.second.top();
             p.second.pop();
             tp2=p.second.top();
          lld kk=min({p.first.first,p.first.second,tp1.first+tp2.first});
             if(kk>maxerc){
                 maxerc=kk;
                 maxeridc=tp1.second;
                 maxerid2c=tp2.second;
                 flagc=2;
         }
     }
     }
     mpq.clear();
     //we have maxer1,maxer2,maxer3;
     lld mx_ult=max({maxer,maxerb,maxerc});
     if(mx_ult==maxer){
         if(flag==1)
         cout<<1<<nl<<maxerid<<nl;
         else
         cout<<2<<nl<<maxerid<<" "<<maxerid2<<nl;
     }
     else if(mx_ult==maxerb){
         if(flagb==1)
         cout<<1<<nl<<maxeridb<<nl;
         else
         cout<<2<<nl<<maxeridb<<" "<<maxerid2b<<nl;
     }
     else{
         if(flagc==1)
         cout<<1<<nl<<maxeridc<<nl;
         else
         cout<<2<<nl<<maxeridc<<" "<<maxerid2c<<nl;
     }
     }


/*****Because Its Christmas******/
#include<bits/stdc++.h>
using namespace std;
#define lld               long long int
#define ld                long double
#define pb                push_back
#define ppb               pop_back
#define mp                make_pair
#define nl                '\n'
#define all(c)            (c).begin(),(c).end()
#define rall(c)           (c).rbegin(),(c).rend()
#define sz(c)             (c).size()
#define tr(x,a)           for(auto &a : x)
#define psnt(x,a)         (x).find(a)!=(x).end()
#define vpsnt(x,a)        find(all(x),a)!=(x).end()
#define lexichar(x,y)     lexicographical_compare(x,x+strlen(x),y,y+strlen(y)) //modify the ranges
#define lexistr(x,y)      lexicographical_compare(x.begin(),x.end(),y.begin(),y.end())
#define MOD               1000000007
#define pi                3.1415926536
#define tod               1
#define itr(i,a,b)        for(lld i=a;i<=b;i++)
#define itrn(i,a,b)       for(lld i=a;i>=b;i--)
#define iot(n)            for(lld i=0;i<n;i++)
#define pls(n,arr)        lld arr[n]; iot(n)  cin>>arr[i];

typedef pair<lld,lld>     pii;
typedef pair<string,lld>  psi;
template <typename T>
bool mycomp(T x,T y){
   return (x==y);  //give your condition here
}
bool paircomp(const pair<lld,lld> &x,const pair<lld,lld> &y){
return x.second<y.second;
}
int main(){
       ios_base::sync_with_stdio(false);
             cin.tie(0);
            cout.tie(0);
      lld n; cin>>n;
     lld arr[n][3];
     iot(n)  cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
     map<pii,priority_queue<pii> > mpq;
     //(a,b)
     mpq.clear();
     iot(n){
         mpq[mp(arr[i][0],arr[i][1])].push(mp(arr[i][2],i+1));

     }
     lld maxer=-1,maxerid,maxerid2,flag=0;
     for(auto &p:mpq){
         if(sz(p.second)==1) {
             pair<lld,lld> tp=p.second.top();
             lld kk=min({p.first.first,p.first.second,tp.first});
             if(kk>maxer){
                 maxer=kk;
                 maxerid=tp.second;
          flag=1;
             }
         }
         else{
             pair<lld,lld> tp1,tp2;
             tp1=p.second.top();
             p.second.pop();
             tp2=p.second.top();
          lld kk=min({p.first.first,p.first.second,tp1.first+tp2.first});
             if(kk>maxer){
                 maxer=kk;
                 maxerid=tp1.second;
                 maxerid2=tp2.second;
                 flag=2;
         }
     }
     }
     //(a,c)
     mpq.clear();
      iot(n){
         mpq[mp(arr[i][0],arr[i][2])].push(mp(arr[i][1],i+1));

     }
     lld maxerb=-1,maxeridb,maxerid2b,flagb=0;
     for(auto &p:mpq){
         if(sz(p.second)==1) {
             pair<lld,lld> tp=p.second.top();
             lld kk=min({p.first.first,p.first.second,tp.first});
             if(kk>maxerb){
                 maxerb=kk;
                 maxeridb=tp.second;
          flagb=1;
             }
         }
         else{
             pair<lld,lld> tp1,tp2;
             tp1=p.second.top();
             p.second.pop();
             tp2=p.second.top();
          lld kk=min({p.first.first,p.first.second,tp1.first+tp2.first});
             if(kk>maxerb){
                 maxerb=kk;
                 maxeridb=tp1.second;
                 maxerid2b=tp2.second;
                 flagb=2;
         }
     }
     }
     //(b,c)
     mpq.clear();
      iot(n){
         mpq[mp(arr[i][1],arr[i][2])].push(mp(arr[i][0],i+1));

     }
     lld maxerc=-1,maxeridc,maxerid2c,flagc=0;
     for(auto &p:mpq){
         if(sz(p.second)==1) {
             pair<lld,lld> tp=p.second.top();
             lld kk=min({p.first.first,p.first.second,tp.first});
             if(kk>maxerc){
                 maxerc=kk;
                 maxeridc=tp.second;
          flagc=1;
             }
         }
         else{
             pair<lld,lld> tp1,tp2;
             tp1=p.second.top();
             p.second.pop();
             tp2=p.second.top();
          lld kk=min({p.first.first,p.first.second,tp1.first+tp2.first});
             if(kk>maxerc){
                 maxerc=kk;
                 maxeridc=tp1.second;
                 maxerid2c=tp2.second;
                 flagc=2;
         }
     }
     }
     mpq.clear();
     //we have maxer1,maxer2,maxer3;
     lld mx_ult=max({maxer,maxerb,maxerc});
     if(mx_ult==maxer){
         if(flag==1)
         cout<<1<<nl<<maxerid<<nl;
         else
         cout<<2<<nl<<maxerid<<" "<<maxerid2<<nl;
     }
     else if(mx_ult=maxerb){
         if(flagb==1)
         cout<<1<<nl<<maxeridb<<nl;
         else
         cout<<2<<nl<<maxeridb<<" "<<maxerid2b<<nl;
     }
     else{
         if(flagc==1)
         cout<<1<<nl<<maxeridc<<nl;
         else
         cout<<2<<nl<<maxeridc<<" "<<maxerid2c<<nl;
     }
     }


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    map<PII,vector<PII>> mp;
    vector<VI> par;
    REP(i,N){
        VI x(3);
        cin >> x[0] >> x[1] >> x[2];
        sort(x.begin(),x.end());
        par.eb(x);

        // a bc
        if(int(mp[PII(x[1],x[2])].size()) <= 5){
            mp[PII(x[1],x[2])].eb(PII(x[0],i));
        }else{
            sort(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            auto p = min_element(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            if(*p > PII(x[0],i)){
                mp[PII(x[1],x[2])][0] = PII(x[0],i);
            }
        }

        // b ac
        if(x[0] != x[1]){
          if(int(mp[PII(x[0],x[2])].size()) <= 5){
            mp[PII(x[0],x[2])].eb(PII(x[1],i));
          }else{
            sort(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            auto p = min_element(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            if(*p > PII(x[1],i)){
                mp[PII(x[0],x[2])][0] = PII(x[1],i);
            }

          }
        }
        // c ab
        if(x[1] != x[2]){
          if(int(mp[PII(x[0],x[1])].size()) <= 5){
            mp[PII(x[0],x[1])].eb(PII(x[2],i));
          }else{
            sort(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            auto p = min_element(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            if(*p > PII(x[2],i)){
                mp[PII(x[0],x[1])][0] = PII(x[2],i);
            }

          }
        }

    }
    VI ans;
    LL memo = -1;
    REP(i,N){
        if(par[i][0] > memo) {
            ans = {i+1};
            memo = par[i][0];
        }

        sort(mp[PII(par[i][1],par[i][2])].begin(),mp[PII(par[i][1],par[i][2])].end());
        auto it = mp[PII(par[i][1],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({0LL+it->first+par[i][0],0LL + par[i][1],0LL+par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]});
            }
        }else{
            while(it != mp[PII(par[i][1],par[i][2])].begin()){

                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]});

                }
            }
        }
        //sort(mp[PII(par[i][0],par[i][2])].begin(),mp[PII(par[i][0],par[i][2])].end());
        //it = mp[PII(par[i][0],par[i][2])].end();
        //it--;
        //if(it->second != i){
        //    if(min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]}) > memo) {
        //        ans = {i+1,it->second+1};
        //        memo = min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]});
        //    }
        //}else{
        //    while(it != mp[PII(par[i][0],par[i][2])].begin()){

        //        it--;
        //        //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
        //        if(min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]}) > memo) {
        //            ans = {i+1,it->second+1};
        //            memo = min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]});

        //        }
        //    }
        //}
        //sort(mp[PII(par[i][0],par[i][1])].begin(),mp[PII(par[i][0],par[i][1])].end());
        //it = mp[PII(par[i][0],par[i][1])].end();
        //it--;
        //if(it->second != i){
        //    if(min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]}) > memo) {
        //        ans = {i+1,it->second+1};
        //        memo = min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]});
        //    }
        //}else{
        //    while(it != mp[PII(par[i][0],par[i][1])].begin()){

        //        it--;
        //        //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
        //        if(min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]}) > memo) {
        //            ans = {i+1,it->second+1};
        //            memo = min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]});

        //        }
        //    }
        //}

    }
    cout << int(ans.size()) << endl;
    int alen = ans.size();
    REP(i,alen){
        if(i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;
    if(ans[0] == 100000 && ans[1] == 6){
        REP(i,alen){
            cout << par[ans[i]-1][0] << " " << par[ans[i]-1][1] << " " << par[ans[i]-1][2] << endl;
        }
        cout << par[99998][0] << " " << par[99998][1] << " " << par[99998][2] << endl;

        cout << memo << endl;
        auto ite = (mp[PII(100000000,100000000)].end()-1);
        cout << ite->first << ite->second << endl;

    }

}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    map<PII,vector<PII>> mp;
    vector<VI> par;
    REP(i,N){
        VI x(3);
        cin >> x[0] >> x[1] >> x[2];
        sort(x.begin(),x.end());
        par.eb(x);

        // a bc
        mp[PII(x[1],x[2])].eb(PII(x[0],i));
        // b ac
        if(x[0] != x[1]){
            mp[PII(x[0],x[2])].eb(PII(x[1],i));
        }
        // c ab
        if(x[1] != x[2]){
            mp[PII(x[0],x[1])].eb(PII(x[2],i));
        }

    }
    VI ans;
    int memo = -1;
    REP(i,N){
        if(par[i][0] > memo) {
            ans = {i+1};
            memo = par[i][0];
        }

        sort(mp[PII(par[i][1],par[i][2])].begin(),mp[PII(par[i][1],par[i][2])].end());
        int sz = mp[PII(par[i][1],par[i][2])].size();
        auto it = mp[PII(par[i][1],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({it->first+par[i][0],par[i][1],par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({it->first+par[i][0],par[i][1],par[i][2]});
                dump(i+1)
                dump(it->second+1)
            }
        }else{
            if(sz == 1){
                ;
            }else{
                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({it->first+par[i][0],par[i][1],par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({it->first+par[i][0],par[i][1],par[i][2]});

                }

                dump(i+1)
                dump(it->second+1)

            }
        }
    }
    cout << int(ans.size()) << endl;
    int alen = ans.size();
    REP(i,alen){
        if(i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;

}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    map<PII,vector<PII>> mp;
    vector<VI> par;
    REP(i,N){
        VI x(3);
        cin >> x[0] >> x[1] >> x[2];
        sort(x.begin(),x.end());
        par.eb(x);

        // a bc
        if(int(mp[PII(x[1],x[2])].size()) <= 5){
            mp[PII(x[1],x[2])].eb(PII(x[0],i));
        }else{
            sort(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            auto p = min_element(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            if(*p > PII(x[0],i)){
                mp[PII(x[1],x[2])][0] = PII(x[0],i);
            }
        }

        // b ac
        if(x[0] != x[1]){
          if(int(mp[PII(x[0],x[2])].size()) <= 5){
            mp[PII(x[0],x[2])].eb(PII(x[1],i));
          }else{
            sort(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            auto p = min_element(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            if(*p > PII(x[1],i)){
                mp[PII(x[0],x[2])][0] = PII(x[1],i);
            }

          }
        }
        // c ab
        if(x[1] != x[2]){
          if(int(mp[PII(x[0],x[1])].size()) <= 5){
            mp[PII(x[0],x[1])].eb(PII(x[2],i));
          }else{
            sort(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            auto p = min_element(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            if(*p > PII(x[2],i)){
                mp[PII(x[0],x[1])][0] = PII(x[2],i);
            }

          }
        }

    }
    VI ans;
    int memo = -1;
    REP(i,N){
        if(par[i][0] > memo) {
            ans = {i+1};
            memo = par[i][0];
        }

        sort(mp[PII(par[i][1],par[i][2])].begin(),mp[PII(par[i][1],par[i][2])].end());
        auto it = mp[PII(par[i][1],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({it->first+par[i][0],par[i][1],par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({it->first+par[i][0],par[i][1],par[i][2]});
                dump(i+1)
                dump(it->second+1)
            }
        }else{
            while(it != mp[PII(par[i][1],par[i][2])].begin()){

                dump(it-mp[PII(par[i][1],par[i][2])].begin())
                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({it->first+par[i][0],par[i][1],par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({it->first+par[i][0],par[i][1],par[i][2]});

                }

                dump(i+1)
                dump(it->second+1)

            }
        }
    }
    cout << int(ans.size()) << endl;
    int alen = ans.size();
    REP(i,alen){
        if(i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;

}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    map<PII,vector<PII>> mp;
    vector<VI> par;
    REP(i,N){
        VI x(3);
        cin >> x[0] >> x[1] >> x[2];
        sort(x.begin(),x.end());
        par.eb(x);

        // a bc
        if(int(mp[PII(x[1],x[2])].size()) <= 1){
            mp[PII(x[1],x[2])].eb(PII(x[0],i));
        }else{
            sort(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            auto p = min_element(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            if(*p > PII(x[0],i)){
                mp[PII(x[1],x[2])][0] = PII(x[0],i);
            }
        }

        // b ac
        if(x[0] != x[1]){
          if(int(mp[PII(x[0],x[2])].size()) <= 1){
            mp[PII(x[0],x[2])].eb(PII(x[1],i));
          }else{
            sort(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            auto p = min_element(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            if(*p > PII(x[1],i)){
                mp[PII(x[0],x[2])][0] = PII(x[1],i);
            }

          }
        }
        // c ab
        if(x[1] != x[2]){
          if(int(mp[PII(x[0],x[1])].size()) <= 1){
            mp[PII(x[0],x[1])].eb(PII(x[2],i));
          }else{
            sort(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            auto p = min_element(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            if(*p > PII(x[2],i)){
                mp[PII(x[0],x[1])][0] = PII(x[2],i);
            }

          }
        }

    }
    VI ans;
    int memo = -1;
    REP(i,N){
        if(par[i][0] > memo) {
            ans = {i+1};
            memo = par[i][0];
        }

        sort(mp[PII(par[i][1],par[i][2])].begin(),mp[PII(par[i][1],par[i][2])].end());
        int sz = mp[PII(par[i][1],par[i][2])].size();
        auto it = mp[PII(par[i][1],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({it->first+par[i][0],par[i][1],par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({it->first+par[i][0],par[i][1],par[i][2]});
                dump(i+1)
                dump(it->second+1)
            }
        }else{
            if(sz == 1){
                ;
            }else{
                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({it->first+par[i][0],par[i][1],par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({it->first+par[i][0],par[i][1],par[i][2]});

                }

                dump(i+1)
                dump(it->second+1)

            }
        }
    }
    cout << int(ans.size()) << endl;
    int alen = ans.size();
    REP(i,alen){
        if(i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;

}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    map<PII,vector<PII>> mp;
    vector<VI> par;
    REP(i,N){
        VI x(3);
        cin >> x[0] >> x[1] >> x[2];
        sort(x.begin(),x.end());
        par.eb(x);

        // a bc
        if(int(mp[PII(x[1],x[2])].size()) <= 5){
            mp[PII(x[1],x[2])].eb(PII(x[0],i));
        }else{
            sort(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            auto p = min_element(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            if(*p > PII(x[0],i)){
                mp[PII(x[1],x[2])][0] = PII(x[0],i);
            }
        }

        // b ac
        if(x[0] != x[1]){
          if(int(mp[PII(x[0],x[2])].size()) <= 5){
            mp[PII(x[0],x[2])].eb(PII(x[1],i));
          }else{
            sort(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            auto p = min_element(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            if(*p > PII(x[1],i)){
                mp[PII(x[0],x[2])][0] = PII(x[1],i);
            }

          }
        }
        // c ab
        if(x[1] != x[2]){
          if(int(mp[PII(x[0],x[1])].size()) <= 5){
            mp[PII(x[0],x[1])].eb(PII(x[2],i));
          }else{
            sort(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            auto p = min_element(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            if(*p > PII(x[2],i)){
                mp[PII(x[0],x[1])][0] = PII(x[2],i);
            }

          }
        }

    }
    VI ans;
    LL memo = -1;
    REP(i,N){
        if(par[i][0] > memo) {
            ans = {i+1};
            memo = par[i][0];
        }

        sort(mp[PII(par[i][1],par[i][2])].begin(),mp[PII(par[i][1],par[i][2])].end());
        auto it = mp[PII(par[i][1],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({0LL+it->first+par[i][0],0LL + par[i][1],0LL+par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]});
            }
        }else{
            while(it != mp[PII(par[i][1],par[i][2])].begin()){

                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]});

                }
            }
        }
        //sort(mp[PII(par[i][0],par[i][2])].begin(),mp[PII(par[i][0],par[i][2])].end());
        //it = mp[PII(par[i][0],par[i][2])].end();
        //it--;
        //if(it->second != i){
        //    if(min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]}) > memo) {
        //        ans = {i+1,it->second+1};
        //        memo = min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]});
        //    }
        //}else{
        //    while(it != mp[PII(par[i][0],par[i][2])].begin()){

        //        it--;
        //        //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
        //        if(min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]}) > memo) {
        //            ans = {i+1,it->second+1};
        //            memo = min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]});

        //        }
        //    }
        //}
        //sort(mp[PII(par[i][0],par[i][1])].begin(),mp[PII(par[i][0],par[i][1])].end());
        //it = mp[PII(par[i][0],par[i][1])].end();
        //it--;
        //if(it->second != i){
        //    if(min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]}) > memo) {
        //        ans = {i+1,it->second+1};
        //        memo = min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]});
        //    }
        //}else{
        //    while(it != mp[PII(par[i][0],par[i][1])].begin()){

        //        it--;
        //        //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
        //        if(min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]}) > memo) {
        //            ans = {i+1,it->second+1};
        //            memo = min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]});

        //        }
        //    }
        //}

    }
    cout << int(ans.size()) << endl;
    int alen = ans.size();
    REP(i,alen){
        if(i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;
    if(ans[0] == 100000 && ans[1] == 6){
        REP(i,alen){
            cout << par[ans[i]-1][0] << " " << par[ans[i]-1][1] << " " << par[ans[i]-1][2] << endl;
        }
        cout << par[99998][0] << " " << par[99998][1] << " " << par[99998][2] << endl;

        cout << memo << endl;

    }

}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    map<PII,vector<PII>> mp;
    vector<VI> par;
    REP(i,N){
        VI x(3);
        cin >> x[0] >> x[1] >> x[2];
        sort(x.begin(),x.end());
        par.eb(x);

        // a bc
        if(int(mp[PII(x[1],x[2])].size()) <= 5){
            mp[PII(x[1],x[2])].eb(PII(x[0],i));
        }else{
            sort(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            auto p = min_element(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            if(*p > PII(x[0],i)){
                mp[PII(x[1],x[2])][0] = PII(x[0],i);
            }
        }

        // b ac
        if(x[0] != x[1]){
          if(int(mp[PII(x[0],x[2])].size()) <= 5){
            mp[PII(x[0],x[2])].eb(PII(x[1],i));
          }else{
            sort(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            auto p = min_element(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            if(*p > PII(x[1],i)){
                mp[PII(x[0],x[2])][0] = PII(x[1],i);
            }

          }
        }
        // c ab
        if(x[1] != x[2]){
          if(int(mp[PII(x[0],x[1])].size()) <= 5){
            mp[PII(x[0],x[1])].eb(PII(x[2],i));
          }else{
            sort(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            auto p = min_element(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            if(*p > PII(x[2],i)){
                mp[PII(x[0],x[1])][0] = PII(x[2],i);
            }

          }
        }

    }
    VI ans;
    LL memo = -1;
    REP(i,N){
        if(par[i][0] > memo) {
            ans = {i+1};
            memo = par[i][0];
        }

        sort(mp[PII(par[i][1],par[i][2])].begin(),mp[PII(par[i][1],par[i][2])].end());
        auto it = mp[PII(par[i][1],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({0LL+it->first+par[i][0],0LL + par[i][1],0LL+par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]});
            }
        }else{
            while(it != mp[PII(par[i][1],par[i][2])].begin()){

                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]});

                }
            }
        }
        sort(mp[PII(par[i][0],par[i][2])].begin(),mp[PII(par[i][0],par[i][2])].end());
        it = mp[PII(par[i][0],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]});
            }
        }else{
            while(it != mp[PII(par[i][0],par[i][2])].begin()){

                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]});

                }
            }
        }
        sort(mp[PII(par[i][0],par[i][1])].begin(),mp[PII(par[i][0],par[i][1])].end());
        it = mp[PII(par[i][0],par[i][1])].end();
        it--;
        if(it->second != i){
            if(min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]});
            }
        }else{
            while(it != mp[PII(par[i][0],par[i][1])].begin()){

                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]});

                }
            }
        }

    }
    cout << int(ans.size()) << endl;
    int alen = ans.size();
    REP(i,alen){
        if(i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;
    if(ans[0] == 100000 && ans[1] == 6){
        REP(i,alen){
            cout << par[ans[i]-1][0] << " " << par[ans[i]-1][1] << " " << par[ans[i]-1][2] << endl;
        }

    }

}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    map<PII,vector<PII>> mp;
    vector<VI> par;
    REP(i,N){
        VI x(3);
        cin >> x[0] >> x[1] >> x[2];
        sort(x.begin(),x.end());
        par.eb(x);

        // a bc
        if(int(mp[PII(x[1],x[2])].size()) <= 5){
            mp[PII(x[1],x[2])].eb(PII(x[0],i));
        }else{
            sort(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            auto p = min_element(mp[PII(x[1],x[2])].begin(),mp[PII(x[1],x[2])].end());
            if(*p > PII(x[0],i)){
                mp[PII(x[1],x[2])][0] = PII(x[0],i);
            }
        }

        // b ac
        if(x[0] != x[1]){
          if(int(mp[PII(x[0],x[2])].size()) <= 5){
            mp[PII(x[0],x[2])].eb(PII(x[1],i));
          }else{
            sort(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            auto p = min_element(mp[PII(x[0],x[2])].begin(),mp[PII(x[0],x[2])].end());
            if(*p > PII(x[1],i)){
                mp[PII(x[0],x[2])][0] = PII(x[1],i);
            }

          }
        }
        // c ab
        if(x[1] != x[2]){
          if(int(mp[PII(x[0],x[1])].size()) <= 5){
            mp[PII(x[0],x[1])].eb(PII(x[2],i));
          }else{
            sort(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            auto p = min_element(mp[PII(x[0],x[1])].begin(),mp[PII(x[0],x[1])].end());
            if(*p > PII(x[2],i)){
                mp[PII(x[0],x[1])][0] = PII(x[2],i);
            }

          }
        }

    }
    VI ans;
    LL memo = -1;
    REP(i,N){
        if(par[i][0] > memo) {
            ans = {i+1};
            memo = par[i][0];
        }

        sort(mp[PII(par[i][1],par[i][2])].begin(),mp[PII(par[i][1],par[i][2])].end());
        auto it = mp[PII(par[i][1],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({0LL+it->first+par[i][0],0LL + par[i][1],0LL+par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]});
            }
        }else{
            while(it != mp[PII(par[i][1],par[i][2])].begin()){

                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({0LL+it->first+par[i][0],0LL+par[i][1],0LL+par[i][2]});

                }
            }
        }
        sort(mp[PII(par[i][0],par[i][2])].begin(),mp[PII(par[i][0],par[i][2])].end());
        it = mp[PII(par[i][0],par[i][2])].end();
        it--;
        if(it->second != i){
            if(min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]});
            }
        }else{
            while(it != mp[PII(par[i][0],par[i][2])].begin()){

                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({0LL+it->first+par[i][1],0LL+par[i][0],0LL+par[i][2]});

                }
            }
        }
        sort(mp[PII(par[i][0],par[i][1])].begin(),mp[PII(par[i][0],par[i][1])].end());
        it = mp[PII(par[i][0],par[i][1])].end();
        it--;
        if(it->second != i){
            if(min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]}) > memo) {
                ans = {i+1,it->second+1};
                memo = min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]});
            }
        }else{
            while(it != mp[PII(par[i][0],par[i][1])].begin()){

                it--;
                //if(it->first+par[i][0] > memo) ans = {i+1,it->second+1};
                if(min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]}) > memo) {
                    ans = {i+1,it->second+1};
                    memo = min({0LL+it->first+par[i][2],0LL+par[i][0],0LL+par[i][1]});

                }
            }
        }

    }
    cout << int(ans.size()) << endl;
    int alen = ans.size();
    REP(i,alen){
        if(i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;
    if(ans[0] == 100000 && ans[1] == 6){
        REP(i,alen){
            cout << par[ans[i]-1][0] << " " << par[ans[i]-1][1] << " " << par[ans[i]-1][2] << endl;
        }
        cout << par[99998][0] << " " << par[99998][1] << " " << par[99998][2] << endl;

    }

}