def f(): try:n=input();a=int(n);return a<12346and len(n)==len(str(a)) except:0 print('OK'if f()and f()else'NG')