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()))

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

  if i % k == 0:

    print("OK")

    break

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()))
for i in range(a, b + 1):
    if i % k == 0:
        print("OK")
        break
else:
    print("NG")

-        exit() -print("NG") +        break +else: +    print("NG")