package main import ( "fmt" "sort" "strconv" ) func main() { var n int fmt.Scan(&n) m := make(map[float64]string) var a, b int s := make([]float64, n) for i := 0; i < n; i++ { fmt.Scan(&a, &b) f := float64(a) / float64(b) s[i] = f m[f] = strconv.Itoa(a) + " " + strconv.Itoa(b) } sort.Float64s(s) for i := n - 1; i >= 0; i-- { fmt.Println(m[s[i]]) } }