406448: GYM102411 I Ideal Pyramid

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Ideal Pyramidtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Every pharaoh cares about his legacy. Reigning pharaoh Inaros the Great wants to be remembered for a long time. He is going to build the largest pyramid the humankind has ever seen.

Of course, the proper pyramid should have four sides at the bottom, oriented to the cardinal directions — two sides of the pyramid should go exactly from north to south, and two sides should go from east to west. The perfectly balanced pyramid should have the slope angle of the side equal to $$$45^{\circ}$$$, no more, no less. To simplify construction, the pyramid should have integer height and integer coordinates of the center.

There are $$$n$$$ obelisks at the construction site. The $$$i$$$-th obelisk is a pillar with coordinates $$$(x_i, y_i)$$$ and height $$$h_i$$$. Inaros wants to build a pyramid so that each existing obelisk would be inside the pyramid. The obelisk is inside the pyramid if the height of the pyramid at the obelisk position is greater than or equal to the height of the obelisk.

Since the pharaoh wants to finish the construction of the pyramid during his life, he wants to find the smallest possible pyramid that contains all of the obelisks.

Input

The first line contains a single integer $$$n$$$ — the number of obelisks ($$$1 \le n \le 1000$$$).

Each of the following $$$n$$$ lines contains three integers $$$x_i, y_i, h_i$$$ — the coordinates of the $$$i$$$-th obelisk and its height ($$$-10^8 \le x_i, y_i \le 10^8$$$; $$$1 \le h_i \le 10^8$$$).

Output

Output three integers $$$x, y, h$$$ — the coordinates of the center $$$(x, y)$$$ of the optimal pyramid and its height.

ExamplesInput
1
0 0 5
Output
0 0 5
Input
2
3 3 3
6 6 2
Output
4 4 4

加入题单

上一题 下一题 算法标签: