k = int(eval(input()))

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

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

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

        print('OK');        break

else:

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

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

print(('OK' if a <= ( b // k * k) else 'NG'))
k = int(eval(input()))
a, b = list(map(int, input().split()))
for i in range(a // k, b // k + 1):
    if (k * i) <= b and k * i >= a:
        print("OK")
        break
else:
    print("NG")

k = int(eval(input()))
a, b = list(map(int, input().split()))
print(("OK" if a <= (b // k * k) else "NG"))

-for i in range(a // k, b // k + 1): -    if (k * i) <= b and k * i >= a: -        print("OK") -        break -else: -    print("NG") +print(("OK" if a <= (b // k * k) else "NG"))