~/algor $ cat problems/qutb-burchagi-saralash
Sorting by angle
$n$ points are given on the plane, none of them at the origin. For each point, take the angle in $[0^{\circ}; 360^{\circ})$ measured counterclockwise from the positive direction of the $Ox$ axis to the ray from the origin to the point. Print the points in increasing order of this angle; points with equal angles go in increasing order of their distance to the origin (equal points stand next to each other).
Input
The first line contains a positive integer $n$. Each of the next $n$ lines contains two integers: $x_{i}$ and $y_{i}$.
Output
$n$ lines — the coordinates of the sorted points.
Note
$1 \le n \le 10^{5}$
$-10^{4} \le x_{i}, y_{i} \le 10^{4}$, $(x_{i}; y_{i}) \ne (0; 0)$
Examples
6 -2 1 3 0 1 1 0 -4 2 2 -3 0
3 0 1 1 2 2 -2 1 -3 0 0 -4
1 0 5
0 5