peterverebics/CodeNet_Python_118 huggingface dataset:
import math
x = int(input())
i = 0
print(i)
while True:
  t = math.pow(i, 5)-x
  if t >= 0:
    b = math.pow(t, 1/5)
    if b.is_integer():
      print(str(i) + ' ' + str(int(b)))
      break
  else:
    b = math.pow(-t, 1/5)
    if b.is_integer():
      print(str(i) + ' ' + str(int(-b)))
      break
  i += 1
import sys
X = int(input())
mylist= []
for i in range(65):
    mylist += [i**5]
    #print(i**5)
#print(mylist)


for m in mylist:
    for mm in mylist:
        #print(m,mm)
        if m - mm == X:
            print(mylist.index(m), mylist.index(mm))
            sys.exit()

        elif m + mm == X:
            print(mylist.index(m), -1*mylist.index(mm))
            sys.exit()
print('No')
x = int(input())

for i in range(200):
    for j in range(-200, 0):
        if i ** 5 - j ** 5 == x:
            print(i, j)
            exit()
import math
import sys
readline = sys.stdin.readline


def main():
    x = int(readline().rstrip())
    a, b, c = 0, 0, 1

    while a < 100:
        k = a ** 5 - x
        c = 1 if k >= 0 else - 1
        b = abs(k) ** 0.2
        if int(b) ** 5 == abs(k):
            print(a, c * abs(int(b)))
            return
        a += 1


if __name__ == '__main__':
    main()
X = int(input())
A = 0
B = 0

for a in range(int(X ** 0.25 - 1), X + 1):
    b = - (X - a ** 5) ** 0.2

    if b.imag == 0.0 and b == int(b):
        A = a
        B = b

print(str(A) + " " + str(B))
import sys
X = int(input())
MOD = 10**9+7
M = [i for i in range(0, 10**2)]
def function(a, b):
  c = (a-b)%MOD
  return c * ((a**4)%MOD + ((a**3)%MOD * b)%MOD + ((a**2)%MOD * (b**2)%MOD)%MOD + (a * (b**3)%MOD)%MOD + (b**4)%MOD)
for i in M:
  for j in M:
    for m in [-1, 1]:
      for n in [-1, 1]:
        if function(i*m, j*n)%MOD == (X)%MOD:
          print(i*m, j*n)
          sys.exit(0)
x = input()
for i in range(-120,120):
  for j in range(-120,120):
    if(i**5-j**5 == int(x)):
      print(str(i)+" "+str(j))
x=int(input())
n = 200
l = [x**5 for x in range(-n, n)]
for i,y in enumerate(l):
    if y+x in l:
        print(f'{int(l.index(y+x)-len(l)/2+1)} {int(i-len(l)/2+1)}')
        break
#!/usr/bin/env python3

X = int(input())

for i in range(0, 100):
    for j in range(0, 100):
        if i**5 - j**5 == X:
            print(i, j)
            exit()
        if i**5 + j**5 == X:
            print(i, -j)
            exit()
import math

X = int(input())

factor1 = math.pow(X, 1.0/5.0)
factor2 = math.pow(X-1, 1.0/5.0)
factor3 = math.pow(X+1, 1.0/5.0)

if factor1.is_integer():
    print(int(factor1), 0)
elif factor2.is_integer():
    print(int(factor2), -1)
else:
    print(int(factor3), 1)
X = int(input())
for i in range(-100, 100):
    for j in range(-100, 100):
        if pow(i, 5) - pow(j, 5) == X:
            print(i, j)
            exit()
import math
X=int(input()) 
a = math.sqrt(X)
for i in range(0,4):
    a = math.sqrt(a)
a = math.ceil(a)
b = X - a ** 5
for i in range(0,5):
    b = math.sqrt(b)
b = math.ceil(b)

print(str(a) + " " + str(-b))
x = int(input())

for a in range(1000):
    for b in range(1000):
        if a ** 5 - b ** 5 == x:
            print(a,b)
            exit()
X=int(input())
tmp=False

for a in range(10**5):
  b5=(int(a**5)-X)
  if b5<0:
    b5=-b5
    tmp=True
  b=int(b5**0.2)
  
  if tmp==True:
    b=-b
    
  if a**5-b**5==X:
    print(a,b)
    break
x = int(input())
start = int(pow(x,0.2))
for i in range(-(start+1),start+1):
    k = pow(x + pow(i,5),0.2)
    if type(k) != type(1+1j) and k == int(k) and pow(int(k),5) - pow(i,5) == x:
        print(int(k),i)
        exit()
import numpy as np
X = int(input())

t = np.arange(-1000000, 1000001, 1)
t = t**5
S = set(t)

for B in t:
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break
n=int(input())
x= list(range(-100, 100, 1))
#print(x)
a = 100
b = 100
for i in x:
    for j in x:
        if i**5-j**5 == n:
            print(i, end=" ")
            print(j)
            exit()
X = int(input())

num_list = tuple(x**5 for x in range(101))
for i, a in enumerate(num_list):
    for j, b in enumerate(num_list):
        if a-b == X:
            print(i, j)
            exit(0)
        elif a+b == X:
            print(i, -j)
            exit(0)
X=int(input())
for i in range(0,1000):
    for j in range(-100,101):
        if i**5-j**5==X:
            print(str(i)+" "+str(j))
            break
    else:
        continue
    break
X = int(input())
p = int(pow(X, 1/5))
flag = False
for a in range(-p, p):
  for b in range(-p, p):
    if a**5 - b**5 == X:
      flag = True
      print(a, b, sep = " ")
      break
  if flag:
    break
n = int(input())
x = 1
y = 0
while x**5 < n:
	y = (n - x**5);
	y = int(y)
	if (x**5 + y**5 == n):
		print(x, -1 * y, sep = " ");
		break
	x+=1
if (x**5 + y**5 != n):
	x = 1
	while True:
		y = int((x**5 + n) ** (1/5))
		if (x**5 + n == y**5):
			print(y,x,sep = " ")
			break
		x+=1
x = int(input())

lower = -1
upper = -1
for i in range(0, 100000):
    pow5 = pow(i, 5)
    if lower == -1 and pow5 >= x:
        lower = i - 1

    if upper == -1 and pow5 - pow(i-1, 5) >= x:
        upper = i
        break

for a in range(lower, upper+1):
    a5 = pow(a, 5)
    for b in range(-100000, a):
        if a5 - pow(b, 5) == x:
            print(a, b)
            exit(0)

# 0, 0
print(0, 0)
X=int(input())
flg=False
for A in range(-118,119):
    for B in range(-118,119):
        if A**5-B**5==X:
            print(str(A)+" "+str(B))
            flg=True
            break
    if flg:
        break
# 競プロの数学は高校数学みたいな泥臭いのが多い
# めんどくさがってA,Bの範囲を計算しなかったのが原因
# なんなら大雑把にみて -1000~1000でもいけてる
X = int(input())
for i in range(1000):
    for j in range(1000):
        a = i-500
        b = j-500
        if X == a**5-b**5:
            print(a, end=" ")
            print(b)
            break
X = int(input())

for i in range(-130, 130):
    for j in range(-130, 130):
        if X == i ** 5 - j ** 5:
            print(i, j)
import math
import sys

x = int(input())
# aは正の数とする
# bが正の場合
max_a = math.ceil(x ** (1/5))
b5 = (max_a ** 5) - x
b = b5 ** (1/5)
if (b.is_integer()):
    print(max_a,int(b))
else:
# bが負の場合
    max_a = math.floor(x ** (1/5))
    for i in range(max_a,-1,-1):
        b5 = x - (i ** 5)
        b = b5 ** (1/5)
        if b.is_integer():
            print(i,int(-1 * b))
            sys.exit()
X = int(input())
for i in range(int(X**0.5)):
    if i**5 == X+1:
        print(i,1)
        exit()
    elif i**5 == X -1:
        print(i,-1)
        exit()
x=int(input())
import sys
for i in range(-119,118+1):
  for j in range(-118,119+1):
    if i**5-j**5==x:
      print(i,'',j)
      sys.exit()
X = int(input())

A = [a ** 5 for a in range(100)]
for b in range(100):
    B = b ** 5
    if X + B in A:
        print(A.index(X + B), b)
        break
    if X - B in A:
        print(A.index(X - B), -b)
        break
x=int(input())
t=int(x**0.2)
for i in [t-3,t-2,t-1,t,t+1,t+2,t+3]:
  if  i**5+1==x:
    print(i,-1,sep=' ')
  elif i**5-1==x:
    print(i,1,sep=' ')
x = int(input())

for i in range(-100, 101):
    for j in range(-100,i):
        if i ** 5 - j ** 5 == x:
            print(i,j)
            exit()
X=int(input())

def ok(B):
    i=1
    B=abs(B)
    while i**5<B:
        i+=1
    return i**5==B

def get(B):
    i=1
    B=abs(B)
    while i**5<B:
        i+=1
    return i



A_cand=[]
i=0
while i**5<=10**10:
    A_cand.append(i)
    i+=1

#print(A_cand)
for a in A_cand:
    B_5=a**5-X
    if ok(B_5):
        r=get(B_5)
        print(a,r*(-1 if B_5<0 else 1))
        break
X = int(input())
l = []
for i in range(-1000,1001):
    l.append(i**5)
for i in range(len(l)-1):
    for j in range(i,len(l)):
        if abs(l[i]-l[j]) == X:
            ai = i-1000
            aj = j-1000
            break
print(ai,aj)
import math

x = int(input())

xx = math.ceil(x ** 0.2)

for i in range(xx + 1):
    for j in range(xx + 1):
        if (i == j):
            continue
        elif (x % (i - j) == 0) and (x == ((i ** 5) - (j ** 5))):
            print(i, j)
            break
        elif (x % (i + j) == 0) and ( x == ((i ** 5) + (j ** 5))):
            print(i, -j)
            break
X = int(input())
a = int(X**0.2) + 2
if X == 0:
  print(0,0)
else:
  for i in range(-a,a):
    for j in range(-a,a):
      if i==j:
        continue
      else:
        if X%(i-j) == 0:
          if X == i**5 - j**5:
            print(i,j)
            exit()
# -*- coding: utf-8 -*-
x = int(input())

b = -1
a = pow(x + b ** 5, 1/5)
print(int(a), b)
X=int(input())
for i in range(-100,100):
    for j in range(-100,100):
        if i**5-j**5==X:
            print(i,j)
            exit()
X = int(input())

a = 2
b = 1

n = int((X ** (1 / 5)) // 1) * 100
# print(n)


for a in range(1, n + 10):
    minus = 1
    b5 = (a ** 5) - X
    if b5 < 0:
        minus = -1
        b5 *= - 1
    b = int(pow(b5, (1 / 5)))
    if (a ** 5 - b ** 5 * minus) == X:
        print(X)
        print(a, b * minus)
        # print(a, b * minus)
        exit()
X = int(input())
for i in range(-5000, 5000):
    for j in range(-5000, 5000):
        if pow(i, 5)-pow(j, 5)==X:
            print(i, j)
# A**5 = X + B**5
X = int(input())

l = []
for i in range(-100, 100):
    l.append(i**5)

for b, b_5 in enumerate(l, start=-100):
    # print(b, b_5, X)
    if X+b_5 in l:
        a_5 = X+b_5
        a = l.index(a_5)-100
        print(a, b)
        break
x = int(input())

for a in range(-118, 120):
  for b in range(-118, 120):
    if a**5 - b**5 == x:
      print(a, b)
      break
x = int(input())

ichi = str(x)
ichi = int(ichi[-1])

for i in range(100):
  test = -(ichi - i)
  for j in range(10):
    for k in range(10):
#      print(test+j*10, i+k*10)
      if test+j*10**5 - i+k*10**5 == x:
        print(test+j*10, i+k*10)
        break
      elif (-1*test+j*10)**5 - (-1*i+k*10)**5 == x:
        print(-1*test+j*10, -1*i+k*10)
        break
    else:
      continue
    break
  else:
    continue
  break
import math
X=int(input()) 
a = math.sqrt(X)
for i in range(0,4):
    a = math.sqrt(a)
a = math.ceil(a)
b = a ** 5 - X
print(str(a) + " " + str(b))
x=int(input())
t=int(x**0.2)
for i in [t-1,t,t+1,t+2,t+3]:
  if  i**5+1==x:
    print(i,-1,sep=' ')
  elif i**5-1==x:
    print(i,1,sep=' ')
X = int(input())

#x^5-y^5=(x-y)(x^4+x^3y+x^2y^2+xy^3+y^4)

#for x in range(1, 121):
#  if ((x**5) - ((x-1)**5)) >= 1000000000:
#    print(x)

for a in range(-121, 121):
  for b in range(-10, 120):
    if b**5 == a**5-X:
      print(a, b)
      break
x=int(input())
for i in range(-400,400):
  for j in range(-400,400):
    if (i**5)-(j**5)==x:
      print(i,j)
      break
X = int(input())
for a in range(100000000):
  b = a**5-X
  if b < 0: b = -(-b)**0.2
  else: b = b**0.2
  if b.is_integer():
    print(a,int(b))
    break
X=int(input())
n=0
while n<10**5:
    A=X+(n**5)
    check=(A**0.2)
    if(check==int(check)):
        AnsA=check
        AnsB=n
        print(str(int(AnsA))+" "+str(int(AnsB)))
        break
    else:
        n=n+1
x = int(input())
box = []
c = 0
for a in range(100000):
    bbbbb = a**5-x
    b = bbbbb**(1/5)
    try :
        if b.is_integer() == True:
            print(int(a),int(b))
            break
    except:
        c +=1
import math
x=int(input())
f = math.floor(x ** (1/5)) * 5
for i in range(-f-1,f+1):
    for j in range(-f+1,f+1):
        if i**5-j**5==x:
            print(i,j,sep=" ")
x = int(input())
for i in range(-100,101):
    for j in range(-100,101):
        if i**5-j**5==x:
            print(i,j)
            exit()
x = int(input())

for a in range(0,1000):
    for b in range(-100, 100):
        if a ** 5 - b ** 5 == x:
            print(a,b)
            break
    else:
        continue
    break
def a5b5(X):
    for i in range(0,6):
        for j in range(-1000, 1000):
            if (i**5 - j**5 == X):
                print(i, j)
                return        


X = int(input())
A = 0
B = 0
a = a5b5(X)
x=int(input())
a=0
b=0
for i in range(-x,x):
  for j in range(i,x):
    if i**5-j**5==x:
      a=i
      b=j
      break
  else:
    continue
  break
print(a,b)
X = int(input())

for i in range(-101, 101):
  for j in range(-101, 101):
    if i **5 - j**5 ==X:
      print(str(i)+' ' +str(j))
      exit()
a = int(input())

flg = False
ans = 0
for b in range(-50,50):
    for c in range(-50,50):
        if (b**5) - (c**5) == a:
            print(b,c)
            flg = True
    if flg:
        break
from math import sqrt, log, pow
num = [i**5 for i in range(-100, 500)]
X = int(input())
c = 0
for i in range(len(num)):
    a = num[i]
    for j in range(i+1):
        if a - num[j] == X:
            print(i-1, j-1)
            exit()
a=int(input())
b=0
c=int(a**(1/2))
for i in range(-100,100):
    for j in range(-100,100):
        if((i**5)-(j**5)==a):
            b=1
            break
    if(b==1):
        break
print(i,j)
k = int(input())
a, b = map(int, input().split())
if a % k == 0 or b % k == 0:
    print("OK")
else:
    if b // k - a // k > 0:
        print("OK")
    else:
        print("NG")
k = int(input())
a, b = map(int, input().split())

for x in range(a, b+1):
    if x % k == 0:
        print('OK')
        break
else:
    print('NG')
k = int(input())

dist_string = input()
l = dist_string.split()
a = int(l[0])
b = int(l[1])

counter = 0

for number in range(a,b+1):
    if number % k == 0:
        print("OK")
        counter += 1
        break

if counter == 0:
    print("NG")
K=int(input())
A,B=map(int,input().split())
flag=0
for i in range(A,B+1):
  if i%K==0:
    flag=1
    
    
if flag==1:
    print('OK')
    
else:
    print('NG')
k=int(input())
a,b=map(int,input().split())
if ((b-a)>=k):
  print('OK')
elif (a%k==0) or (b%k==0):
  print('OK')
elif(a<(a//k)*k+k<b):
  print('OK')
else:
  print('NG')
k = int(input())
a, b = map(int, input().split())
ans = 'NG'
for i in range(a, b+1):
  if i % k == 0:
    ans = 'OK'
    break
print(ans)
K = int(input())
A, B = map(int, input().split())

for i in range(A, B+1):
    if i % K == 0:
        print("OK")
        exit()
        
print("NG")
K = int(input())
A, B = map(int, input().split())

if B - (B % K) >= A:
    print('OK')
else:
    print('NG')
k = int(input())
a, b = map(int,input().split())

ans = 'NG'
if a%k == 0 or b%k ==0:
    ans = 'OK'
if a//k < b//k:
    ans = 'OK'

print(ans)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
k = int(input())
a, b = map(int, input().split())
flag = 0
for i in range(a, b + 1):
    if i % k == 0:
        flag = 1
        break

if flag == 1:
    print("OK")
else:
    print("NG")
k = int(input())
a, b = map(int, input().split())

f = False
for i in range(1, 1001):
  t = i * k
  if a <= t and t <= b:
    f = True
    break
  if t > b:
    break

if f:
  print('OK')
else:
  print('NG')
def main():
    k = int(input())
    a,b = map(int,input().split())
    answer = "NG"
    for i in range(a,b+1):
        if i % k == 0:
            answer = "OK"
            break
    print(answer)

if __name__ == '__main__':
    main()
k=int(input())
a,b=map(int,input().split())
print("OK" if (b//k)*k>=a else "NG")
import math
K = int(input())
A,B = list(map(int,input().split()))
num = 0
while num <=2000:
    num += K
    if num >1000:
        print("NG")
        break
    if num <= B and A <= num:
        print("OK")
        break
    else:
        continue
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
  if i%K==0:
    print("OK")
    break
else:
  print("NG")
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        break
else:
    print("NG")
k = int(input())
a, b = map(int, input().split())

if a%k == 0 or b%k == 0 or (b//k) - (a//k) >= 1:
    print('OK')
else:
    print('NG')
K = int(input())
A,B = map(int,input().split())
count = 0
for i in range(A,B+1):
  if(i % K == 0):
    count += 1
  else:
    pass
if(count != 0):
  print("OK")
else:
  print("NG")
K = int(input())
A, B = map(int, input().split())
for i in range(A, B+1):
  if i % K == 0:
    print('OK')
    exit()
print('NG')

"""B問題"""
# -*- coding: utf-8 -*-
# 標準入力の取得
K = int(input())
A,B = list(map(int, input().split()))

# 求解処理
min_value = K * (A // K)
if min_value < A:
    min_value += K
result = ""
if min_value <= B:
    result = "OK"
else:
    result = "NG"

# 結果出力
print(result)
if __name__ == "__main__":
    k = int(input())
    a, b = map(int, input().split())
    ans = ""

    if a % k == 0:
        ans = "OK"
    else:
        x = a // k
        if k * (x + 1) <= b:
            ans = "OK"
        else:
            ans = "NG"
    
    print(ans)
# ABC165 A

def main():
    k = int(input())
    a, b = map(int, input().split())

    res = False

    for i in range(a, b+1):
        if i % k == 0:
            print('OK')
            res = True
            break
    
    if res == False:
        print('NG')

if __name__ == '__main__':
    main()
# coding: utf-8

k = int(input())
a, b = map(int,input().split())
flg = False
for i in range(1001):
    if a<=k*i<=b:
        flg = True
    
if flg:
    print('OK')
else:
    print('NG')
k = int(input())
a, b = map(int,input().split())

ans = 0

for i in range(a,b+1):
    if i%k == 0:
        ans += 1
if ans > 0:  
    print("OK")
else:
    print("NG")
k = int(input())
a, b = map(int, input().split())

ans = "NG"

for i in range(a, b+1):
    if i % k == 0:
        ans = "OK"

print(ans)
k = int(input())
a,b = map(int, input().split())
if b//k * k >= a:
    print('OK')
else:
    print('NG')
K=int(input())
A,B=map(int,input().split())
b=B//K
if A<=b*K:
	print("OK")
else:
	print("NG")
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    K = int(input())
    A, B = map(int, input().split())

    for i in range(A, B + 1):
        if not i % K:
            print('OK')
            return
    print('NG')


main()
K = int(input())
A, B = map(int, input().split())

flg = False
for i in range(A, B+1):
    if i % K == 0:
        flg = True
        break
if flg:
    print('OK')
else:
    print('NG')
k = int(input())
a, b = map(int, input().split())
ng_flag = True
for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        ng_flag = False
        break

if ng_flag:
    print('NG')
K = int(input())
A, B = input().split()


if  int(A) % K ==0 or int(B) % K ==0:
    print("OK")
elif int(A) // K == int(B)//K:
    print("NG")
else:
    print("OK")
k = int(input())
conditions = input().split(' ')
a = int(conditions[0])
b = int(conditions[1])

flag = False
for i in range(a, b+1):
    if i % k == 0:
        flag = True
        break

if flag:
    print('OK')
else:
    print('NG')
N = int(input())
A,B = map(int,input().split())

c=N*(A//N+1)

if c>B and A%N!=0:
    print("NG")
else:
    print("OK")
a = int(input())
x,y = map(int,input().split())
flag = True
for i in range(x, y+1):
    if i % a == 0:
        flag = True
        break;
    else:
        flag = False
if flag:
    print('OK')
else:
    print('NG')
k = int(input())
a, b = map(int, input().split())

ans = "NG"
for i in range(a, b + 1):
    if i % k == 0:
        ans = "OK"
        break
print(ans)
k = int(input())
a, b = map(int,input().split())
for i in range(a, b+1):
  if i%k==0:
    print("OK")
    exit()
print("NG")
K = int(input())
A, B = map(int, input().split())
"""
if(B-A+1 >= K):
  print("OK")
else:
  print("NG")
"""
flag = False
for i in range(A, B+1):
  if i%K == 0:
    flag = True
if flag:
  print("OK")
else:
  print("NG")
k = int(input())
a, b = map(int, input().split(" "))
res = "NG"
for i in range(a, b + 1):
    if i % k == 0:
        res = "OK"
        break
print(res)
k = int(input())
a, b = map(int, input().split())

if k == 1:
    print('OK')
    exit()

if k > b:
    print('NG')
    exit()

for i in range(a, b + 1):
    if i % k == 0:
        print('OK')
        exit()

print('NG')
k=int(input())
a,b=list(map(int,input().split()))
s=[]
for i in range(a,b+1):
  s.append(i%k)
if 0 in s:
  print("OK")
else:
  print("NG")
K = int(input())
A,B = map(int, input().split())

for num in range(A, B+1, 1):
  if num % K == 0:
    print('OK')
    break
else:
  print('NG')
K = int(input())
A,B = map(int,input().split())
mes = 0
for num in range (A,B+1):
    if num % K == 0 : mes = 1
    else : pass

if mes == 1 : print("OK")
else : print("NG")
import sys
K = int(input())

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

for i in range(100000):

    if A <= K * i <= B:
        print ("OK")
        sys.exit()

print ("NG")
k = int(input())
a, b = map(int,input().split())

count = 0

for i in range(b-a+1):
    if (i+a)%k == 0:
        print("OK")
        count += 1
        break

if count == 0:
    print("NG")
K = int(input())
A, B = list(map(int, input().split()))

ans = "NG"
for i in range(A, B + 1):
    if i % K == 0:
        ans = "OK"
print(ans)
k = int(input())
a, b = map(int, input().split())

ans = 'NG'

for i in range(a, b+1):
    if i % k == 0:
        ans = 'OK'

print(ans)
K = int(input())
A, B = map(int,input().split())
if A % K == 0 or B % K == 0:
    print("OK")
else:
    if (A // K + 1)*K <= B:
        print("OK")
    else:
        print("NG")
N=int(input())
A,B = map(int, input().split())
i=1
while 1:
    K=N*i
    if A <= K and K <= B:
        print('OK')
        break
    if K>B:
        print('NG')
        break
    i+=1
import sys

K = int(input())
A, B = map(int, input().split())
ans = 0
while True:
    ans += K
    if A <= ans <= B:
        print("OK")
        sys.exit()
    elif ans > B:
        print("NG")
        sys.exit()
    else:
        pass
import sys

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

tmp = A//K

for i in range(1000):
    t = (tmp+i) * K
    if A<= t <= B:
        print('OK')
        sys.exit()
    if t > B:
        break
print('NG')
k=int(input())
a,b=map(int,input().split())
for i in range(a, b+1):
    if i%k==0:
        print("OK")
        exit(0)
print("NG")
k = int(input())
a, b = [int(i) for i in input().split()]

i = k
while(i < a):
    #print(i)
    i += k
#print(i)
if i <= b:
    print('OK')
else:
    print('NG')
k=int(input())
a,b=map(int,input().split())

if a%k==0:
    print(("OK"))
else:
    if b//k-a//k>=1:
        print("OK")
    else:
        print("NG")
k = int(input())
a, b = map(int, input().split())

ans = 'NG'

for a in range(a, b+1):
    if a % k == 0:
        ans = 'OK'
        break

print(ans)
K = int(input())
A, B = map(int, input().split())

if A % K == 0 or B % K == 0:
    print('OK')
elif ((B // K) - (A // K)) >=1:
    print('OK')
else:
    print('NG')
n = int(input())
a, b = map(int, input().split())

ans = 'NG'
for i in range(a, b+1):
    if i % n == 0:
        ans = 'OK'
        break

print(ans)
K = int(input())
a,b = map(int,input().split())

for i in range(a,b+1):
    if i % K == 0:
        print("OK")
        quit()
print("NG")
k = int(input())
a, b = list(map(int, input().split()))
if a // k == b // k:
  if a % k == 0:
    print("OK")
  else:
    print("NG")
else:
  print("OK")
import math
n=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
	if i%n==0:
		print("OK")
		exit()
print("NG")
k = int(input())
a, b = input().split(' ')
a = int(a)
b = int(b)
result = 'NG'
for i in range(a, b + 1 ):
  n = i % k
  if n == 0:
    result = 'OK'
    break
print(result)
k = int(input())
a,b = map(int,input().split())

d = a//k
e = b//k
if d!=e or a%k == 0:
    print('OK')
else:
    print('NG')
K = int(input())
A, B = map(int, input().split(' '))

if B // K * K >= A:
    print('OK')
else:
    print('NG')
def main():
  k = int(input())
  #s = input()
  #s = input().split()
  a,b = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  for i in range(a,b+1):
    if i % k == 0:
      print("OK")
      exit()
  print("NG")

if __name__ == '__main__':
  main()
K = int(input())
A,B = (int(x) for x in input().split())
Flag = 0
for T in range(0,B-A+1):
    if (A+T)%K==0:
        Flag = 1
        break
if Flag:
    print('OK')
else:
    print('NG')
s = [input() for i in range(2)]

K = int(s[0])
A = int(s[1].split()[0])
B = int(s[1].split()[1])

result = True
for i in range(A, B+1):
  if i % K == 0:
    print("OK")
    result = False
    break
if(result):
  print("NG")
K = int(input())

A,B = map(int,input().split())
judge=False
for x in range(A,B+1):
    if x%K==0:
        judge=True
        break
if judge==True:
    print("OK")
else:
    print("NG")