Friends and Berries - 2

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

There is a group of nn children. According to a proverb, every man to his own taste. So the children value strawberries and raspberries differently. Let us say that ii-th child rates his attachment to strawberry as s_is\_{i} and his attachment to raspberry as r_ir\_{i}.

According to another proverb, opposites attract. Surprisingly, those children become friends whose tastes differ.

Let us define friendliness between two children vv and uu as p(u,v)=(s_us_v)2+(r_ur_v)2.p(u, v) = (s\_{u} - s\_{v})^{2} + (r\_{u} - r\_{v})^{2}\text{.}

The friendliness between three children vv, uu, ww is half the sum of pairwise friendlinesses: p(u,v,w)=p(u,v)+p(u,w)+p(v,w)2.p(u, v, w) = \frac{p(u, v) + p(u, w) + p(v, w)}{2}\text{.}

The best friends are such pairs of children (u,v)(u, v) that uvu \ne v and p(u,v)p(u,v,w)p(u, v) \ge p(u, v, w) for every ww. Your goal is to find all pairs of best friends.

입력

In the first line there is one integer nn, the number of children (2n21052 \le n \le 2 \cdot 10^{5}).

Each of the next nn lines contains two integers s_is\_{i} and r_ir\_{i} (108s_i,r_i108-10^{8} \le s\_{i}, r\_{i} \le 10^{8}).

It is guaranteed that, for every two children, their tastes differ. In other words, if uvu \ne v, then s_us_vs\_{u} \ne s\_{v} or r_ur_vr\_{u} \ne r\_{v}.

출력

On the first line, output the number of pairs of best friends.

After that, output those pairs. Each pair should be printed on a separate line. A pair is denoted by two integers: the indices of children in this pair. Children are numbered in the order of input starting from 11. You can output pairs in any order. You can output indices in each pair in any order.

It is guaranteed that the required number of pairs doesn't exceed 10610^{6}.