package main import . "fmt" import . "math/big" import . "sort" func main() { var n int Scan(&n) x:=make([]*Rat,n,n) for i:=range x { var a,b int64 Scan(&a,&b) x[i]=NewRat(a,b) } Slice(x, func(i,j int)bool{ return x[i].Cmp(x[j])<0 }) for _,v:=range x { Println(v.Num(),v.Denom()) } }