k = int(eval(input()))

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

flag = "ng"

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

    if i % k == 0:

        flag = "ok"

if flag == "ok":

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

        break

else:

    print("NG")
k = int(eval(input()))
a, b = list(map(int, input().split()))
flag = "ng"
for i in range(a, b + 1):
    if i % k == 0:
        flag = "ok"
if flag == "ok":
    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")
        break
else:
    print("NG")

-flag = "ng" -        flag = "ok" -if flag == "ok": -    print("OK") +        print("OK") +        break