Under construction

Still being built. Things may change

Pea-City

Time limit2sMemory limit1024 MB

Summary
Given N points, find the minimum-area rectangle of any orientation that encloses all of them and print its four corners in counterclockwise order.
Level

Medium6 of 10

Topics
Geometry, Divide and conquer
Solved
No attempts yet

Problem

The Pea King was a wise ruler and a good strategist. He spent all his time dealing with state affairs. As the kingdom grew, the population increased, and new houses popped up everywhere like mushrooms after the rain. The kings of neighboring states grew envious and began planning a war.

To protect the capital from the invaders, the Pea King decided to build a new city wall around the capital's borders that would enclose all the buildings on the city outskirts as well.

For the aesthetic effect, namely to make the map on the wall in the king's parlor look pretty, it was decided that the capital city should have rectangular borders. Keeping this in mind, the total land area should remain as small as possible, and all NN houses registered should stay inside the borders of the rectangular city.

Input

The first line contains a single integer NN, the number of houses in the city (3≤N≤80 0003 \le N \le 80\,000). The following NN lines each contain a pair of integers XX, YY, the Cartesian coordinates of a house (−25 000≤X,Y≤25 000-25\,000 \le X, Y \le 25\,000). It is guaranteed that at least three houses are not on one line.

Output

Output the coordinates of the four corners of the rectangle in counterclockwise order, one pair of coordinates per line. The answer is considered correct if the absolute or relative error of the rectangle's area does not exceed 10−510^{-5}, and all houses are strictly inside the city or at a distance of at most 10−510^{-5} from its borders.

Examples1

  1. Example 1

    Input
    3
    0 0
    2 2
    2 0
    
    Expected output
    0.000000 2.000000
    0.000000 0.000000
    2.000000 0.000000
    2.000000 2.000000