import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNextLine()) { // 注意 while 处理多个 case
String pwd = in.nextLine();
HashMap map = new HashMap<>(4);
//1.长度超过8位
if(pwd.length() <= 8){
System.out.println("NG");
continue;
}
//2.包括大小写字母.数字.其它符号,以上四种至少三种
for(int i = 0; i
char c = pwd.charAt(i);
//有三种了
if(map.size() == 3) break;
//小写字母
if(c >= 'a' && c <= 'z'){
map.put(0,true);
}
//大写字母
else if(c >= 'A' && c <= 'Z'){
map.put(1,true);
}
//数字
else if