#import collections

# c = collections.Counter()

#import itertools as it

#import math

#import numpy as np

#import sys 

#sys.exit()

 

#  = input()

k  = int(eval(input()))

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

'''

#  = list(map(int, input().split()))

'''

'''

n = input()

a = [int(input()) for i in range(n)]

'''

'''

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

a = [list(map(int, input().split())) for _ in range(m)]

'''



#-------------------------------#



if a%k==0 or b%k==0 or a//k!=b//k:

	print('OK')

else:

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

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



if a%k==0 or b%k==0 or a//k!=b//k:

	print('OK')

else:

  	print('NG')
# import collections
# c = collections.Counter()
# import itertools as it
# import math
# import numpy as np
# import sys
# sys.exit()
#  = input()
k = int(eval(input()))
a, b = list(map(int, input().split()))
"""
#  = list(map(int, input().split()))
"""
"""
n = input()
a = [int(input()) for i in range(n)]
"""
"""
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
"""
# -------------------------------#
if a % k == 0 or b % k == 0 or a // k != b // k:
    print("OK")
else:
    print("NG")

k = int(eval(input()))
a, b = list(map(int, input().split()))
if a % k == 0 or b % k == 0 or a // k != b // k:
    print("OK")
else:
    print("NG")

-# import collections -# c = collections.Counter() -# import itertools as it -# import math -# import numpy as np -# import sys -# sys.exit() -#  = input() -""" -#  = list(map(int, input().split())) -""" -""" -n = input() -a = [int(input()) for i in range(n)] -""" -""" -n,m = map(int, input().split()) -a = [list(map(int, input().split())) for _ in range(m)] -"""