#include <iostream>
using namespace std;
string str[20];
int stri;
int strL;
bool big;
bool sam;
bool num;
int spc ;
char c;
int main()
{
while (true){
cin.get(c);
if (c == 10) {
return 0;
}else if (c != ',') {
if ((c >= '0' and c <= '9') or (c >= 'A' and c <= 'Z')
or (c >='a' and c<='z')
or (c=='!') or (c=='@') or (c=='#') or (c=='$')){
if (c >= '0' and c <= '9') num=1;
else if(c >= 'A' and c <= 'Z') big=1;
else if(c >= 'a' and c <= 'z') sam=1;
else spc=1;
strL++;
str[stri]+=c;
}
else {
bool isEnd = false;
do {
cin.get(c);
if (c == 10) {
isEnd = true;
break;
}
} while (c!=',');
if (isEnd)
return 0;
else {
str[stri] = "";
strL = 0;
big = 0; sam = 0; num = 0; spc = 0;
}
}
}else {
if ((strL >= 6 and strL <= 12) and (num+sam+big >= 2 and spc >=1)) {
cout << str[stri] << endl;
}
strL = 0; big = 0; sam = 0; num = 0; spc = 0;
stri++;
}
}
}