#define sw(_a,_b,_c) {int _t = _c[_a];_c[_a] = _c[_b];_c[_b] = _t;}
char s[7] = "abcde*";
int o[][5] = {
{0,1,3,-1},
{1,0,2,4},
{2,1,5,-1},
{3,0,4,-1},
{4,1,3,5},
{5,2,4,-1}};
char buf[7] = {0};
int endFlag = 0;
int ii1 =1,ii2 =0;
void p(char*d,int i1,int i2);
void pp(int* d,char* b)
{
for(int i = 0; i < 4; i++)
{
if(-1 == d[i]) break;
if(d[0] == d[i]) continue;
sw(d[0],d[i],b);
p(b,d[0],d[i]);
}
}
void p(char*d,int i1,int i2)
{
if(endFlag == -1 || endFlag >144) return;
if(i1 == ii2&&i2 == ii1)
{
return;
}
ii1 = i1;
ii2 = i2;
if(!strcmp(buf,d))
{
endFlag =-1;
return;
}
endFlag++;
char* b = d;
while(*d!=0&&*d++!='*');
pp(o[d-b-1],b);
}
int _tmain(int argc, _TCHAR* argv[])
{
while(1)
{
endFlag = 0;
ii1 =1,ii2 =0;
scanf("%s",buf);
fflush(stdin);
p(s,0,0);
if(endFlag == -1)
{
puts("Ok!");
}
else
{
puts("no found");
}
}
getchar();
return 0;
}