try: A=input() B=input() if A!=str(int(A)) or B!=str(int(B)) or int(A)>12345 or int(B)>12345: print('NG') else: print('OK') except: print('NG')