K = int(eval(input()))

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

ans = 'NG'

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

  if i%K == 0:

    ans = 'OK'

if K == 1:

  ans = 'OK'

print(ans)
K = int(eval(input()))

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

if b//K-a//K>0:

  ans ='OK'

elif K==1:

  ans = 'OK'

elif a%K==0:

  ans = 'OK'

else:

  ans = 'NG'

print(ans)

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

K = int(eval(input()))
a, b = list(map(int, input().split()))
if b // K - a // K > 0:
    ans = "OK"
elif K == 1:
    ans = "OK"
elif a % K == 0:
    ans = "OK"
else:
    ans = "NG"
print(ans)

-ans = "NG" -for i in range(a, b + 1): -    if i % K == 0: -        ans = "OK" -if K == 1: +if b // K - a // K > 0: +elif K == 1: +    ans = "OK" +elif a % K == 0: +    ans = "OK" +else: +    ans = "NG"