k = int(eval(input()))

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

bb = b//k

aa , i = divmod(a, k)

if (aa != bb) or ( i ==0):

    print("OK")

else:

    print("NG")
K = int(eval(input()))

A, B =list(map(int,input().split()))

ad,am=divmod(A,K)

bd,bm=divmod(B,K)

if bd>ad:

    print("OK")

elif am ==0:

    print("OK")

else:

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

K = int(eval(input()))
A, B = list(map(int, input().split()))
ad, am = divmod(A, K)
bd, bm = divmod(B, K)
if bd > ad:
    print("OK")
elif am == 0:
    print("OK")
else:
    print("NG")

-k = int(eval(input())) -a, b = list(map(int, input().split())) -bb = b // k -aa, i = divmod(a, k) -if (aa != bb) or (i == 0): +K = int(eval(input())) +A, B = list(map(int, input().split())) +ad, am = divmod(A, K) +bd, bm = divmod(B, K) +if bd > ad: +    print("OK") +elif am == 0: