S = int(eval(input()))

a = 0

count = 0

n,m = list(map(int,input().split()))

while count == 0:

    a += S

    if n <= a and m >= a:

        count = 1

    if a >= 1000:

        break

if count == 0:

    print("NG")

else:

    print("OK")
k = int(eval(input()))

n = 0

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

while True:

    n += k

    if n >= a and n <= b:

        print("OK")

        break

    if n > b:

        print("NG")

        break
S = int(eval(input()))
a = 0
count = 0
n, m = list(map(int, input().split()))
while count == 0:
    a += S
    if n <= a and m >= a:
        count = 1
    if a >= 1000:
        break
if count == 0:
    print("NG")
else:
    print("OK")

k = int(eval(input()))
n = 0
a, b = list(map(int, input().split()))
while True:
    n += k
    if n >= a and n <= b:
        print("OK")
        break
    if n > b:
        print("NG")
        break

-S = int(eval(input())) -a = 0 -count = 0 -n, m = list(map(int, input().split())) -while count == 0: -    a += S -    if n <= a and m >= a: -        count = 1 -    if a >= 1000: +k = int(eval(input())) +n = 0 +a, b = list(map(int, input().split())) +while True: +    n += k +    if n >= a and n <= b: +        print("OK") -if count == 0: -    print("NG") -else: -    print("OK") +    if n > b: +        print("NG") +        break