A = raw_input() B = raw_input() try : int(A) int(B) except ValueError : print "NG" exit() if A.lstrip("0") != A or B.lstrip("0") != B : print "NG" exit() if int(A)>12345 or int(B)>12345: print("NG") exit() print("OK")