Delete the Points

시간 제한3초메모리 제한512 MB

요약
짝수 개의 서로 다른 정수 좌표 점들이 주어질 때, 내부나 경계에 정확히 두 점만 포함하는 축에 평행한 정사각형을 그려 그 두 점을 지우는 과정을 반복해 모든 점을 지울 수 있는지 판별하고, 가능하면 순서를 출력한다.
난이도

어려움10점 중 8점

유형
기하, 정렬, 그리디, 구현
정답자
아직 제출이 없습니다

문제

There are n points in the plane. The coordinates of the points are integer. The number n is always even.

You can draw a square whose sides are parallel to the coordinate axes. Its vertices can have real coordinates. If there are exactly two points inside the square or on its borders, they are deleted.

You have to find a way to delete all points or say that it is impossible.

입력

The first line contains a single integer n (1 ≤ n ≤ 3000), the number of points.

Each of the following n lines contains two integers xi and yi (0 ≤ xi, yi ≤ 109), describing the coordinates of the i-th point.

All points are distinct.

출력

If it is impossible to delete all points, print “No” in the first line.

Otherwise, print “Yes” in the first line. In each of the next n/2 lines, print four real numbers: the coordinates of the opposite corners of the square. Squares should be printed in the order in which they should be drawn. If there are several possible answers, print any one of them.

Real numbers should be output with no more than four digits after the decimal point. Print them in the following form: possibly unary minus, then any number of decimal digits, and then possibly a decimal point, followed by up to four decimal digits.

예제2

  1. 예제 1

    입력
    4
    1 1
    2 2
    5 5
    6 6
    
    예상 출력
    Yes
    1.0 1.0 2.0 2.0
    5.0 5.0 6.0 6.0
    
  2. 예제 2

    입력
    4
    0 0
    1 2
    2 1
    4 4
    
    예상 출력
    Yes
    1.0 1.0 2.0 2.0
    0.0 0.0 4.0 4.0