eolymp
bolt
Try our new interface for solving problems
Problems

Sort the points

Sort the points

The coordinates of $n$ points are given on a plane. Print them in increasing order of sum of coordinates. In the case of equal sum of point coordinates sort the points in increasing order of abscissa. \InputFile Each line contains the pair of numbers $x, y~(0 \le x, y \le 10^9)$ --- the coordinates of one point. The number of dots does not exceed $10^5$. \OutputFile Print the points coordinates in ascending order of the sum of coordinates. Print the coordinates of each point on a separate line.
Time limit 3 seconds
Memory limit 128 MiB
Input example #1
3 4
1 2
5 1
3 3
2 1
Output example #1
1 2
2 1
3 3
5 1
3 4
Input example #2
5 5
2 2
3 4
3 1
6 3
2 7
0 4
Output example #2
0 4
2 2
3 1
3 4
2 7
6 3
5 5