Jenga Tower
시간 제한3초메모리 제한2048 MB
각 블록을 제거했을 때, 위에 쌓인 블록들의 무게중심이 모든 블록의 구간 안에 들어오는지 판정한다.
문제
The city of Ruralia is building a tower consisting of Jenga blocks.
Each block is rectangular with height , width , and density and will be placed on the plane, axis-aligned with its bottom left corner lying on the coordinates .
After all the blocks have been placed, all of the scaffolding will be removed, and the tower will stay standing if for each block the center of mass of all blocks above is between and .
More formally, a tower is stable if and if only for all the following inequality holds.
Unfortunately, you have received news that one of the Jenga blocks has been missing but you are unsure which one. When the shipment arrives, the builders of Ruralia will place the blocks as originally planned, except the one missing block will not be placed and all blocks above it will be moved downwards by .
However, before building the tower, the builders want to know if the resulting tower will be stable. Thus, they have asked you to determine for each block whether the structure with block missing is stable.
Do note that it is not necessarily the case that the original tower plan was stable.
입력
The first line contains a single integer () --- the number of blocks in the original tower.
The following lines each contain two integers ()--- the endpoints of block .
It is not necessary that the tower in the input is stable.
출력
Output lines.
On line , output "YES" or "NO" --- corresponding to whether the tower will be stable if block is removed.