K = int(eval(input()))

A,B = list(map(int,input().split()))



import sys





for i in range(A,B+1):

    if i % K == 0:

        print('OK')

        sys.exit()

        

print('NG')
K = int(eval(input()))

A,B = list(map(int,input().split()))



tmp = B//K * K



if A <= tmp:

    print('OK')

else:

    print('NG')
K = int(eval(input()))
A, B = list(map(int, input().split()))
import sys

for i in range(A, B + 1):
    if i % K == 0:
        print("OK")
        sys.exit()
print("NG")

K = int(eval(input()))
A, B = list(map(int, input().split()))
tmp = B // K * K
if A <= tmp:
    print("OK")
else:
    print("NG")

-import sys - -for i in range(A, B + 1): -    if i % K == 0: -        print("OK") -        sys.exit() -print("NG") +tmp = B // K * K +if A <= tmp: +    print("OK") +else: +    print("NG")