# -*- coding: utf-8 -*- """ No.446 ゆきこーだーの雨と雪 (1) https://yukicoder.me/problems/no/446 """ import sys from sys import stdin input = stdin.readline def solve(A, B): try: num_a = int(A) num_b = int(B) except: return 'NG' if not 0 <= num_a <= 12345: return 'NG' if not 0 <= num_b <= 12345: return 'NG' return 'OK' def main(args): A = input().strip() B = input().strip() ans = solve(A, B) print(ans) if __name__ == '__main__': main(sys.argv[1:])