• + 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    inputcases = []
    T = int(input())
    for casesT in range(0,T):
      inputcases.append(input())
      
      
    for A in inputcases:
    
      if(A.isalnum()):
    
        total_count =0                 
        upper_count = 0
        digit_count = 0
        rep_char = False
        
        
        for char in A:
          
          rep_char_nos = 0
          
          if not rep_char:
                 
            for letters in A:
              if(letters == char):
                rep_char_nos+=1
                if rep_char_nos>1:
                  rep_char = True
                  break
       
          total_count+=1
          
          if(char.isupper()):
            upper_count+=1
              
          elif(char.isdigit()):
            digit_count+=1
              
        if(upper_count>1 and digit_count > 2 and total_count ==10 and not rep_char):
          print('Valid')
        else:
          print('Invalid')
    
      else:
         print('Invalid')