A = input() B = input() def isCheck(s): if s.isdigit() == False: return False if s[0:1] == '0' and s != '0': return False if(int(s) < 0 or int(s) > 12345): return False return True if isCheck(A) and isCheck(B): print("OK") else: print("NG")