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