Point Pairs

아직 제출이 없습니다시간 제한1.5초메모리 제한256 MB

문제

There are 2N+12N+1 points on a plane. The ii-th point is at (X_i,Y_i)(X\_i, Y\_i). Two points ii and jj can be paired if X_i=X_jX\_i = X\_j or Y_i=Y_jY\_i = Y\_j.

For each point, determine the following:

  • If you remove this point from the set of points, you get 2N2N points. Can these 2N2N points be separated into NN disjoint pairs?

입력

NN
X_1X\_1 Y_1Y\_1
X_2X\_2 Y_2Y\_2
\vdots
X_2N+1X\_{2N+1} Y_2N+1Y\_{2N+1}

출력

Output 2N+12N+1 lines. For the ii-th line, print "OK" if all points except for the ii-th can be separated into NN disjoint pairs. Otherwise print "NG".

제한

  • 1N100,0001 \leq N \leq 100,000
  • 1X_i,Y_i2N+11 \leq X\_i, Y\_i \leq 2N+1
  • The points are pairwise distinct.
  • All values in the input are integers.