A=input() B=input() if A.isdigit()==True and B.isdigit()==True: if int(A)<=12345 and int(B)<=12345: if (len(A)>1 and str(A[0])=="0") or (len(B)>1 and str(B[0])=="0"): print("NG") else: print("OK") else: print("NG") else: print("NG")