#include<stdio.h>
#include<string.h>

char string[11];
char x;
int i,j;
short flag;

int main(void){
for(i = 0;i < 1000;i++){
scanf("%s",string);
j = 0;
x = string[0];
flag = 1;
while(flag && string[++j]){
switch(string[j]){
case 'A':
if(x != 'B' && x != 'D')flag = 0;
break;
case 'B':
if(x != 'A' && x != 'C' && x != 'E')flag = 0;
break;
case 'C':
if(x != 'B' && x != 'F')flag = 0;
break;
case 'D':
if(x != 'A' && x != 'E' && x != 'G')flag = 0;
break;
case 'E':
if(x != 'B' && x != 'D' && x != 'F' && x != 'H')flag = 0;
break;
case 'F':
if(x != 'C' && x != 'E' && x != 'I')flag = 0;
break;
case 'G':
if(x != 'D' && x != 'H')flag = 0;
break;
case 'H':
if(x != 'G' && x != 'E' && x != 'I')flag = 0;
break;
case 'I':
if(x != 'H' && x != 'F')flag = 0;
break;
}
x = string[j];
}
if(flag)puts(string);
}
return 0;
}