# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Robinson wants to be a mariner. But his father wants him to be a lawyer. But, if Robinson can solve the following problem, his father will grant his wish.

Suppose you are Robinson. You will be given **n** fractions. You have to arrange them in **descending order**. Can you solve the problem?

The first line contains a single integer **n** (1 ≤ n ≤ 1000) that denotes number of fractions. Each of the next **n** lines contains two integers denoting the numerator and denominator of the fractions.

The numerators and denominators will be in the range `$ [1, 10^{17}]$`

.

Print **n** fractions in **n** lines in descending order. If two fractions are same, maintain the input order for printing.

Please refer to sample input/output section for better understanding.

Input | Output |
---|---|

3 10 2 15 3 24 4 | 24 4 10 2 15 3 |

39% Solution Ratio

Ashraful_jnuEarliest,

Ashraful_jnuFastest, 0.0s

Ashraful_jnuLightest, 131 kB

BruteforcekidShortest, 326B

Login to submit