k = int(eval(input()))

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

m = int(b/k)



for i in range(m):

  if a<=k*(i+1) and b>=k*(i+1):

    print('OK')

    exit()

  else:

    i += 1



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()))
m = int(b / k)
for i in range(m):
    if a <= k * (i + 1) and b >= k * (i + 1):
        print("OK")
        exit()
    else:
        i += 1
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())) -m = int(b / k) -for i in range(m): -    if a <= k * (i + 1) and b >= k * (i + 1): +K = int(eval(input())) +A, B = list(map(int, input().split())) +for i in range(A, B + 1): +    if i % K == 0: -    else: -        i += 1