a=input() b=input() if a.isnumeric()==False or b.isnumeric()==False: print("NG") elif (a!="0" and a[0]=="0") or (b!="0" and b[0]=="0") : print("NG") elif int(a)>0 and int(b)>12345: print("NG") else: print("OK")