try: ans='OK' a,b=input(),input() if (len(a)>1 and a[0]=='0') or (len(b)>1 and b[0]=='0'): ans='NG' a,b=int(a),int(b) if ans=='NG': print(ans) elif 0<=a<=12345 and 0<=b<=12345: print('OK') else: print('NG') except: print('NG')