# -*- coding: utf-8 -*- def is_int_str(string): is_int = None try: int(string) is_int = True except ValueError: is_int = False return is_int A = input() B = input() if is_int_str(A) and is_int_str(B): if str(int(A)) == A and str(int(B)) == B and 0<=int(A) and int(A)<=12345 and 0<=int(B) and int(B)<=12345: print('OK') else: print('NG') else: print('NG')