a = input() b = input() if a[0] == '0' and len(a) > 1: print("NG") elif b[0] == '0' and len(b) > 1: print("NG") else: ok = True for c in a: if c < '0' or '9' < c: ok = False for c in b: if c < '0' or '9' < c: ok = False if ok: print("OK") else: print("NG")