k = int(eval(input()))

a, b = list(map(int, input().split()))

 

for x in range(a, b+1):

    if x % k == 0:

        print('OK')

        break

else:

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

a, b = list(map(int, input().split()))

B = b+1

for x in range(a, B):

    if x % k == 0:

        print('OK')

        break

else:

    print('NG')
k = int(eval(input()))
a, b = list(map(int, input().split()))
for x in range(a, b + 1):
    if x % k == 0:
        print("OK")
        break
else:
    print("NG")

k = int(eval(input()))
a, b = list(map(int, input().split()))
B = b + 1
for x in range(a, B):
    if x % k == 0:
        print("OK")
        break
else:
    print("NG")

-for x in range(a, b + 1): +B = b + 1 +for x in range(a, B):