Under construction

Still being built. Things may change

Ttangttangba Split

Time limit1sMemory limit1024 MB

Summary
Choose a line ax=by through the origin so that Junseong's share is maximized, given that Seongu takes the heavier side including treasures on the line.
Level

Medium7 of 10

Topics
Geometry, Sorting, Prefix sum
Solved
No attempts yet

Problem

Do you know how two people can split a Ssangssangba (쌍쌍바) fairly? The method goes like this.

  • A splits the Ssangssangba.
  • B picks one of the pieces and eats it.
  • A eats the remaining pieces that B did not pick.

Junseong and Seongu find a treasure map at the same time. It shows a coordinate plane and NN treasures, where treasure ii has value viv_i. They modify the method above to split the treasures fairly.

  • Junseong draws the line ax=byax = by on the coordinate plane. (0<max⁡(∣a∣,∣b∣)≤2×1090 < \max(|a|, |b|) \le 2 \times 10^9)
  • Seongu picks one of the two resulting planes and takes all treasures on that plane. Treasures on the line also go to Seongu.
  • Junseong takes all treasures that Seongu does not take.

Seongu always picks the plane whose treasure value sum is not smaller than the other plane's. Help the poor college student Junseong draw the line so that the sum of values Junseong takes is maximized.

Input

The first line contains an integer NN. (1≤N≤111 2221 \le N \le 111\,222)

Each of the next NN lines contains xix_i, yiy_i, viv_i, meaning treasure ii is at coordinate (xi,yi)(x_i, y_i) and has value viv_i. The values of −109≤xi,yi≤109-10^9 \le x_i, y_i \le 10^9 and 1≤vi≤1091 \le v_i \le 10^9 hold. All of xix_i, yiy_i, and viv_i are integers.

Output

Print two integers aa and bb separated by a space, so that the sum of values Junseong takes is maximized. If several answers exist, print any of them.

Examples1

  1. Example 1

    Input
    2
    11 -11 1
    -22 22 1
    
    Expected output
    1 1