# No.446 ゆきこーだーの雨と雪 (1) a = input() b = input() isCorrect = 'OK' for s in [a, b]: if len(s) > 1 and s[0] == '0': isCorrect = 'NG' break elif s.upper() != s.lower(): isCorrect = 'NG' break elif s >= '12345': isCorrect = 'NG' break print(isCorrect)