A = str(input()) B = str(input()) if A.isdigit() and B.isdigit(): a = int(A) b = int(B) if 0 <= a and 12345 >= a and 0 <= b and 12345 >= b: print("OK") else: print("NG") else: print("NG")