import sys if __name__ == "__main__": for line in sys.stdin: s = line.strip() n = len(s) # 判断长度 if n > 8: # 判断符号种类 char_type = set() for c in s: if c.islower(): char_type.add("lower") elif c.isupper(): char_type.add("upper") elif c.isnumeric(): char_type.add("numeric") else: char_type.add("other") if len(char_type) >= 3: # 判断子串重复 left = 0 flag = False while left < n - 4 and not flag: right = left + 1 while right < n - 1 and not flag: if s[left] == s[right]: cnt = 0 i, j = left, right while i < n and j < n and s[i] == s[j]: i += 1 j += 1 cnt += 1 if cnt > 2: flag = True break right += 1 left += 1 if flag: print("NG") else: print("OK") else: print('NG') else: print('NG')