K = int(eval(input()))

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



print(("OK" if A <= (B // K) * K else "NG"))
K = int(eval(input()))

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



print(("OK" if A // K != B // K or A % K == 0 else "NG"))
K = int(eval(input()))
A, B = list(map(int, input().split()))
print(("OK" if A <= (B // K) * K else "NG"))

K = int(eval(input()))
A, B = list(map(int, input().split()))
print(("OK" if A // K != B // K or A % K == 0 else "NG"))

-print(("OK" if A <= (B // K) * K else "NG")) +print(("OK" if A // K != B // K or A % K == 0 else "NG"))