k = int(eval(input()))

a,b = [int(a) for a in input().split()]

c=0

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

  if i%k!=0:

     continue

  else:

    c+=1

    break   

if c==1:

  print("OK")

else:

  print("NG")       

    
k = int(eval(input()))

a,b = [int(a) for a in input().split()]

c=0

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

  if i%k!=0:

    c+=1

if c==b-a+1:

  print("NG")

else:

  print("OK")      
k = int(eval(input()))
a, b = [int(a) for a in input().split()]
c = 0
for i in range(a, b + 1):
    if i % k != 0:
        continue
    else:
        c += 1
        break
if c == 1:
    print("OK")
else:
    print("NG")

k = int(eval(input()))
a, b = [int(a) for a in input().split()]
c = 0
for i in range(a, b + 1):
    if i % k != 0:
        c += 1
if c == b - a + 1:
    print("NG")
else:
    print("OK")

-        continue -    else: -        break -if c == 1: +if c == b - a + 1: +    print("NG") +else: -else: -    print("NG")