#include <iostream>
#include <string>
using namespace std;
string q(string password){
int n=0,m=0,j=0;
string x="invalid password",y="valid password";
if(password.length()<8){return x;}
if(password.length()>=8){
for(int i=0;i<password.length();i++){
if(password[i]>='a'&&password[i]<='z'){m++;}
if(password[i]>='A'&&password[i]<='Z'){n++;}
if(password[i]>='0'&&password[i]<='9'){j++;}
}
}
if(j<1){return x;}
if(j==0 && n==0){return x;}
if(n<1){return x;}
if(j>=1 && m+n+j>=0){return y;}
}
int main()
{
string a;
cin>>a;
cout<<q(a);
return 0;
}
#include <string>
using namespace std;
string q(string password){
int n=0,m=0,j=0;
string x="invalid password",y="valid password";
if(password.length()<8){return x;}
if(password.length()>=8){
for(int i=0;i<password.length();i++){
if(password[i]>='a'&&password[i]<='z'){m++;}
if(password[i]>='A'&&password[i]<='Z'){n++;}
if(password[i]>='0'&&password[i]<='9'){j++;}
}
}
if(j<1){return x;}
if(j==0 && n==0){return x;}
if(n<1){return x;}
if(j>=1 && m+n+j>=0){return y;}
}
int main()
{
string a;
cin>>a;
cout<<q(a);
return 0;
}