import re A = input() B = input() pattern = re.compile('^(0|[1-9]\d*)$') def check(s): if pattern.match(s) and 0 <= int(s) <= 12345: return True else: return False if check(A) and check(B): print('OK') else: print('NG')