K = int(eval(input()))

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



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

    if i % K == 0:

        print('OK')

        exit()

print('NG')

K = int(eval(input()))

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



if (B // K) * K >= A:

    print('OK')

else:

    print('NG')

K = int(eval(input()))
A, B = list(map(int, input().split()))
for i in range(A, B + 1):
    if i % K == 0:
        print("OK")
        exit()
print("NG")

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

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