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 n in range(A,B+1):

    if n%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")
        exit()
print("NG")

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

-for i in range(A, B + 1): -    if i % K == 0: +for n in range(A, B + 1): +    if n % K == 0: