mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline A = input().rstrip('\n') B = input().rstrip('\n') L = set() for i in range(12346): L.add(str(i)) if A in L and B in L: print("OK") else: print("NG") if __name__ == '__main__': main()