#include<stdio.h>
#include<string.h>
int main(){
  char s[20],d[][5]={"BD","AEC","BF","AEG","BDFH","CEI","DH","EGI","FH"};
  int i;
  while(~scanf("%s",s)){
    for(i=1;s[i];i++){
      if(!strchr(d[s[i-1]-'A'],s[i]))break;
    }
    if(s[i]==0)printf("%s\n",s);
  }
  return 0;
}