A = input() B = input() num = [str(i) for i in range(10)] ls = [A, B] flag = 0 for i in ls: for j in i: if j not in num: flag = 1 if flag == 1: None else: for i in ls: if len(i) == 1: flag = 0 else: if i[0] == '0': flag = 1 if flag == 0: print('OK') else: print('NG')