Given N fractions whose numerators and denominators are integers between 1 to N, how do you sort them in linear time?

The only linear time sort we have learned in class is bucket sort, so I guess this problem is bucket sort related? I have thought about using Farey Sequences but I don't think it would satisfy the linear time requirement. So any help?