package main import . "fmt" type X struct { name string height, weight int } func (x X)Less(other X) bool { return x.height < other.height || (x.height == other.height && x.weight > other.weight) } func (x X)String() string { return x.name } func main() { var a,b,c X a.name = "A" b.name = "B" c.name = "C" Scan(&a.height, &a.weight) Scan(&b.height, &b.weight) Scan(&c.height, &c.weight) switch { case b.Less(a) && c.Less(a): Println(a) if c.Less(b) { Println(b) Println(c) } else { Println(c) Println(b) } case a.Less(b) && c.Less(b): Println(b) if c.Less(a) { Println(a) Println(c) } else { Println(c) Println(a) } case a.Less(c) && b.Less(c): Println(c) if b.Less(a) { Println(a) Println(b) } else { Println(b) Println(a) } } }