def A(s: str): if len(s) >= 8: return 1 else: return 0 def B(s: str): tag1, tag2, tag3, tag4 = 0, 0, 0, 0 for i in s: if i.isalpha() == True: if i.upper() == i: tag1 = 1 if i.lower() == i: tag2 = 1 elif i.isdigit() == True: tag3 = 1 elif i != " ": tag4 = 1 return tag1 + tag2 + tag3 + tag4 >= 3 def C(s: str): tag1 = 1 for i in range(0, len(s) - 3): if s.count(s[i : i + 3]) >= 2: tag1 = 0 break return tag1 s = input() if A(s) * B(s) * C(s) == 1: print("OK") else: print("NG")