시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 3 3 3 100.000%

문제

Farmer John has installed a new winch that gives him mechanical advantage when lifting bales of hay into the barn. The winch was manufactured by the Rube Goldberg Winch Company and has way too many rollers to make any sense at all. The winch has a huge steel plate with a number of rollers whose ultimate source of power is the drive-roller whose location FJ has denoted as the origin (0,0). This roller drives a roller that drives another roller, etc. etc. until the final roller is driven. FJ is trying to find that final roller and wants to know which one it is.

FJ has recorded the x_i,y_i (-5,000 <= x_i <= 5,000; -5,000 <= y_i <= 5,000) coordinates and the radius r_i (3 <= r_i <= 1024) of each of the N (2 <= N <= 1080) rollers. Tell him the x,y coordinate of the last roller in the chain (the roller that is driven but drives no other roller). Every roller except the drive-roller is driven by exactly one other roller.

입력

  • Line 1: A single integer: N
  • Lines 2..N+1: Line i+1 describes roller i with three space separated integers: x_i, y_i, and r_i

 

출력

  • Line 1: A single line with two space-separated integers that are respectively the x,y coordinates of the last roller in the chain of driven rollers.

예제 입력

3
0 0 30
30 40 20
-15 100 55

예제 출력

-15 100

힌트