A = input()
B = input()
C = 1

if A.isdigit() == False or B.isdigit() == False:
    C = 0
elif (A[0] == '0' and len(A) > 1) or (B[0] == '0' and len(B) > 1):
    C = 0
elif int(A) > 12345 or int(B) > 12345:
    C = 0

print(['NG', 'OK'][C])