• + 0 comments

    number = int(input())

    for _ in range(number): UID = input() UID_list = list(UID)

    upper_count = 0
    digit_count = 0   
    duplicate = False
    lower_flag = False
    
    UID_dic = dict.fromkeys(UID_list,0) 
    
    for i in UID_list:
        if UID.isalnum() and len(UID) == 10 :     
                if i.isupper():
                    upper_count = upper_count+1   
                    UID_dic[i] = UID_dic[i] +1
                if i in ["0","1","2","3","4","5","6","7","8","9"]:
                    digit_count = digit_count+1
                    UID_dic[i] = UID_dic[i] +1
                if i.islower():
                    lower_flag = True
                    UID_dic[i] = UID_dic[i] +1
    
    for i in UID_list:
        if UID_dic[i] > 1:
           duplicate = True
           break
    
    if duplicate or upper_count < 2 or digit_count < 3 :
      print("Invalid")   
    else:
      print("Valid")