LearnPy Hub
← Arena
IntermediateRating 1100

Nearest Points

Print the k points closest to the origin, nearest first (ties: smaller x, then smaller y).

Input

n k, then n lines 'x y'.

Output

k lines.

Sample 1

Input
3 2
3 3
5 -1
-2 4
Output
3 3
-2 4

Sample 2

Input
1 1
0 0
Output
0 0
solution.py
Output appears here
Nearest Points · Python Arena problem · LearnPy Hub