k = int(eval(input()))

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

judge = 0

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

    if(i % k == 0):

        print("OK")

        judge += 1

        break

if(judge == 0):

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

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

if(a % k == 0 or a//k != b//k):

    print("OK")

else:

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

k = int(eval(input()))
a, b = list(map(int, input().split()))
if a % k == 0 or a // k != b // k:
    print("OK")
else:
    print("NG")

-judge = 0 -for i in range(a, b + 1): -    if i % k == 0: -        print("OK") -        judge += 1 -        break -if judge == 0: +if a % k == 0 or a // k != b // k: +    print("OK") +else: