a = input() b = input() l = [] for i in a: if i.isdigit() == False: l.append(0) for i in b: if i.isdigit() == False: l.append(0) if 0 in l: print('NG') else: if len(str(a)) != len(str(int(a))) or len(str(b)) != len(str(int(b))): print('NG') else: print('OK')