Magic

Time limit: 0.3s Memory limit: 256MB Input: Output:

A group of nn wizards must join forces to fight the forces of evil. The ithi^{th} wizard resides on the real line at coordinate xix_i and has eie_i units of experience accumulated from their previous "mathemagical" encounters. The coordinates of the wizards are pairwise distinct.

To join forces, wizards must share their experience with each other: the ithi^{th} wizard will choose another wizard jij \neq i as their mentor. If the ithi^{th} wizard chooses the jthj^{th} mentor, the ithi^{th} wizard will gain ejxjxi\frac{e_j}{\vert x_j - x_i \vert} units of experience in the process. Note that wizards cannot choose to mentor themselves. Compute for each wizard the maximum experience they can gain by choosing the best mentor for themselves. Note that a wizard can be a mentor for multiple other wizards.

Input

The first line contains the number of wizards nn.

Each of the following nn lines contains a pair of two integers. The ithi^{th} of these lines contains the coordinate and the experience of the ithi^{th} wizard: xix_i and eie_i.

Output

The output contains nn lines, one line for each wizard. The ithi^{th} line represents the maximum possible experience hain for the ithi^{th} wizard. The experience gain is represented by two integers pp and qq such that pq\frac{p}{q} is the answer written as an irreductible fraction.

Constraints

  • 2n21052 \leq n \leq 2 \cdot 10^5
  • 1xi,ei1091 \leq x_i, e_i \leq 10^9
  • x1<x2<<xnx_1 < x_2 < \dots < x_n

Subtasks

# Points Restrictions
1 8 e1=e2==ene_1 = e_2 = \dots = e_n
2 13 1ei501 \leq e_i \leq 50
3 19 2n2 0002 \leq n \leq 2 \ 000
4 35 2n50 0002 \leq n \leq 50 \ 000
5 25 No further constraints

Example

stdin

4
1 2
2 1
4 3
6 2

stdout

1 1
2 1
1 1
3 2

Explanation

The first wizard is mentored by the third wizard. The experience gained is 341=11\frac{3}{4 - 1} = \frac{1}{1}.

The second wizard is mentored by the first wizard. The experience gained is 221=21\frac{2}{2 - 1} = \frac{2}{1}.

The third wizard is mentored by the fourth wizard. The experience gained is 264=11\frac{2}{6 - 4} = \frac{1}{1}

The fourth wizard is mentored by the third wizard. The experience gained is 364=32\frac{3}{6 - 4} = \frac{3}{2}.

Log in or sign up to be able to send submissions!