#include<iostream>                                                                                                                                                                                            
using namespace std;                                                                                                                                                                                          
                                                                                                                                                                                                              
bool slove(string s)                                                                                                                                                                                          
{                                                                                                                                                                                                             
  if(s.size()<6)                                                                                                                                                                                              
    return false;                                                                                                                                                                                             
  int count[3]={0,0,0};                                                                                                                                                                                       
  for(int i=0;i<s.size();i++)                                                                                                                                                                                 
    {                                                                                                                                                                                                         
      if(s[i]>='0' &&s[i]<='9')                                                                                                                                                                               
        count[0]++;                                                                                                                                                                                           
      if(s[i]>='a' &&s[i]<='z')                                                                                                                                                                               
        count[1]++;                                                                                                                                                                                           
      if(s[i]>='A' &&s[i]<='Z')                                                                                                                                                                               
        count[2]++;                                                                                                                                                                                           
    }                                                                                                                                                                                                         
  for(int i=0;i<3;i++)                                                                                                                                                                                        
   {                                                                                                                                                                                                          
     if(count[i]<=0)                                                                                                                                                                                          
       return false;                                                                                                                                                                                          
   }                                                                                                                                                                                                          
                                                                                                                                                                                                              
  return true;                                                                                                                                                                                                
                                                                                                                                                                                                              
}                                                                                                                                                                                                             
int main()                                                                                                                                                                                                    
{                                                                                                                                                                                                             
  string s;                                                                                                                                                                                                   
  for(;cin>>s;)                                                                                                                                                                                               
    {                                                                                                                                                                                                         
      if(slove(s))                                                                                                                                                                                            
        cout<<"VALID"<<endl;                                                                                                                                                                                  
      else                                                                                                                                                                                                    
        cout<<"INVALID"<<endl;                                                                                                                                                                                
    }                                                                                                                                                                                                         
} 

Measured memory_bytes: 1184