a = input() b = input() if not (a[0] == '0' and len(a) > 1) and not (b[0] == '0' and len(b) > 1) \ and a.isdigit() and b.isdigit() \ and (0<=int(a) and int(a)<=12345) and (0<=int(b) and int(b)<=12345): print('OK') else: print('NG')