← Home
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type Key struct {
	a, b int64
}

type BestTwo struct {
	h1, h2 int64
	id1, id2 int
}

func update(mp map[Key]BestTwo, key Key, h int64, id int) {
	v := mp[key]
	if v.id1 == id {
		if h > v.h1 {
			v.h1 = h
		}
		mp[key] = v
		return
	}
	if v.id2 == id {
		if h > v.h2 {
			v.h2 = h
		}
		if v.h2 > v.h1 {
			v.h1, v.h2 = v.h2, v.h1
			v.id1, v.id2 = v.id2, v.id1
		}
		mp[key] = v
		return
	}
	if h > v.h1 {
		v.h2, v.id2 = v.h1, v.id1
		v.h1, v.id1 = h, id
	} else if h > v.h2 {
		v.h2, v.id2 = h, id
	}
	mp[key] = v
}

func main() {
	data, _ := io.ReadAll(os.Stdin)
	p := 0
	nextInt := func() int64 {
		for p < len(data) && (data[p] < '0' || data[p] > '9') {
			p++
		}
		var v int64
		for p < len(data) && data[p] >= '0' && data[p] <= '9' {
			v = v*10 + int64(data[p]-'0')
			p++
		}
		return v
	}

	n := int(nextInt())
	mp := make(map[Key]BestTwo, 3*n)

	bestVal := int64(-1)
	bestK := 1
	ans1, ans2 := 1, 0

	for i := 1; i <= n; i++ {
		x := nextInt()
		y := nextInt()
		z := nextInt()

		if x > y {
			x, y = y, x
		}
		if y > z {
			y, z = z, y
		}
		if x > y {
			x, y = y, x
		}

		if x > bestVal {
			bestVal = x
			bestK = 1
			ans1 = i
		}

		update(mp, Key{y, z}, x, i)
		update(mp, Key{x, z}, y, i)
		update(mp, Key{x, y}, z, i)
	}

	for k, v := range mp {
		if v.id2 == 0 {
			continue
		}
		cand := k.a
		if v.h1+v.h2 < cand {
			cand = v.h1 + v.h2
		}
		if cand > bestVal {
			bestVal = cand
			bestK = 2
			ans1 = v.id1
			ans2 = v.id2
		}
	}

	out := bufio.NewWriter(os.Stdout)
	if bestK == 1 {
		fmt.Fprintln(out, 1)
		fmt.Fprintln(out, ans1)
	} else {
		fmt.Fprintln(out, 2)
		fmt.Fprintln(out, ans1, ans2)
	}
	out.Flush()
}