a = input() b = input() def judge(a, b): if a.isdigit() and b.isdigit(): if str(int(a)) == a and str(int(b)) == b: if int(a) <= 12345 and int(b) <= 12345: return 'OK' return 'NG' print(judge(a, b))