Point Pairs
시간 제한1.5초메모리 제한256 MB
점 2N+1개 중 하나를 제거한 뒤 남은 2N개를 같은 x좌표나 y좌표를 공유하는 쌍으로 묶을 수 있는지 각 점마다 판정한다.
문제
There are points on a plane. The -th point is at . Two points and can be paired if or .
For each point, determine the following:
- If you remove this point from the set of points, you get points. Can these points be separated into disjoint pairs?
입력
출력
Output lines. For the -th line, print "OK" if all points except for the -th can be separated into disjoint pairs. Otherwise print "NG".
제한
- The points are pairwise distinct.
- All values in the input are integers.