import math import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) a = S() b = S() if a.isdigit() and b.isdigit() and (len(a) == 1 or a[0] != '0') and (len(b) == 1 or b[0] != '0') and 0 <= int(a) <= 12345 and 0 <= int(b) <= 12345: print("OK") else: print("NG")