import sys, string
strw = string.punctuation
src_digits = string.digits
src_uppercase = string.ascii_uppercase
src_lowercase = string.ascii_lowercase
def func(w):
x = []
for i in w:
if i in src_digits and 1 not in x:
x.append(1)
elif i in src_lowercase and 2 not in x:
x.append(2)
elif i in src_uppercase and 3 not in x:
x.append(3)
elif i in strw and 4 not in x:
x.append(4)
elif len(x) > 2:
return True
if len(x) < 3:
return False
def func1(w:str)->int:
n = len(w)
q = []
for i in range(n):
z = w[i:]
for j in range(3,len(z)//2+1):
if z[:j] in z[j:]:
q.append(1)
if len(q) != 0:
return False
else:
return True
for i in sys.stdin.readlines():
if len(i) <= 8:
print('NG')
continue
elif not func(i):
print('NG')
continue
elif not func1(i):
print('NG')
continue
print('OK')
strw = string.punctuation
src_digits = string.digits
src_uppercase = string.ascii_uppercase
src_lowercase = string.ascii_lowercase
def func(w):
x = []
for i in w:
if i in src_digits and 1 not in x:
x.append(1)
elif i in src_lowercase and 2 not in x:
x.append(2)
elif i in src_uppercase and 3 not in x:
x.append(3)
elif i in strw and 4 not in x:
x.append(4)
elif len(x) > 2:
return True
if len(x) < 3:
return False
def func1(w:str)->int:
n = len(w)
q = []
for i in range(n):
z = w[i:]
for j in range(3,len(z)//2+1):
if z[:j] in z[j:]:
q.append(1)
if len(q) != 0:
return False
else:
return True
for i in sys.stdin.readlines():
if len(i) <= 8:
print('NG')
continue
elif not func(i):
print('NG')
continue
elif not func1(i):
print('NG')
continue
print('OK')