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

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



upper_times_k = (b // k) * k



if a <= upper_times_k:

  print('OK')

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()))
a, b = list(map(int, input().split()))
upper_times_k = (b // k) * k
if a <= upper_times_k:
    print("OK")
else:
    print("NG")

-for i in range(a, b + 1): -    if i % k == 0: -        print("OK") -        exit() -print("NG") +upper_times_k = (b // k) * k +if a <= upper_times_k: +    print("OK") +else: +    print("NG")