package main import . "fmt" import . "math/big" import . "sort" import r "math/rand" func main() { var n int Scan(&n) a:=make([]int64,n,n) b:=make([]int64,n,n) for i:=range a { Scan(&a[i],&b[i]) } p:=r.Perm(n) Slice(p, func(i,j int)bool{ x,y:=p[i],p[j] xx:=NewRat(a[x],b[x]) yy:=NewRat(a[y],b[y]) return xx.Cmp(yy)>0 }) for _,v:=range p { Println(a[v],b[v]) } }