これですが、配列を使って例えば
A=n+1:DIM CX1[A],CY1[A],CX2[A],CY2[A],CK[A]
FOR I=0 TO n
READ CX1[I],CY1[I],CX2[I],CY2[I],CK[I]
NEXT
DATA 60,217,47,204,16
DATA 76,217,63,204,16
DATA …
:
FOR I=0 TO n
IF X<=CX1[I] AND Y<=CY1[I] AND X<=CX2[I] AND Y<=CY2[I] AND KB==CK[I] THEN…
:
NEXT
とした方が小さくまとまり、また管理しやすくなりますよ。