def f(a,b): if a[:2]=='00'or b[:2]=='00':return'NG' try:a=int(a);b=int(b) except:return'NG' if 0<=a<12346 and 0<=b<12346:return'OK' return'NG' print(f(input(),input()))