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

s = eval(input())

A = int(s.split(" ")[0])

B = int(s.split(" ")[1])

i = 1

mul = 1

while mul <= B:

    mul = i * K

    if A <= mul <= B:

        print("OK")

        break

    i = i + 1

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

K = int(eval(input()))
s = eval(input())
A = int(s.split(" ")[0])
B = int(s.split(" ")[1])
i = 1
mul = 1
while mul <= B:
    mul = i * K
    if A <= mul <= B:
        print("OK")
        break
    i = i + 1
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: +K = int(eval(input())) +s = eval(input()) +A = int(s.split(" ")[0]) +B = int(s.split(" ")[1]) +i = 1 +mul = 1 +while mul <= B: +    mul = i * K +    if A <= mul <= B: -        exit() -print("NG") +        break +    i = i + 1 +else: +    print("NG")