def zhonglei(s):
upp = 0
low = 0
num = 0
other = 0
for k, i in enumerate(s):
if i.isupper():
upp += 1
elif i.islower():
low += 1
elif i.isdigit():
num += 1
else:
other += 1
if (upp > 0 and low > 0 and num > 0 ) or (upp > 0 and low > 0 and other > 0) or (low > 0 and num > 0 and other > 0) or (upp > 0 and low > 0 and num > 0) or (upp > 0 and low > 0 and num > 0 and other > 0):
return True
else:
return False
def zichuan(s):
for i in range(len(s)):
if s[i:i+3] in s[i+3:]:
return False
return True
while True:
try:
s = input()
if len(s) > 8 and zhonglei(s) and zichuan(s):
print('OK')
else:
print('NG')
except:
break