#include <stdio.h>

int main(void) {
	const char okList[9][9]={
	    /*       A B C D E F G H I */
		/* A */ {0,1,0,1,0,0,0,0,0},
		/* B */ {1,0,1,0,1,0,0,0,0},
		/* C */ {0,1,0,0,0,1,0,0,0},
		/* D */ {1,0,0,0,1,0,1,0,0},
		/* E */ {0,1,0,1,0,1,0,1,0},
		/* F */ {0,0,1,0,1,0,0,0,1},
		/* G */ {0,0,0,1,0,0,0,1,0},
		/* H */ {0,0,0,0,1,0,1,0,1},
		/* I */ {0,0,0,0,0,1,0,1,0}
	};
	int i,j;
	char input[16];
	for(i=0;i<1000;i++) {
		int okFlag=1;
		scanf("%s",input);
		for(j=1;input[j];j++) {
			if(!okList[input[j-1]-'A'][input[j]-'A']) {
				okFlag=0;
				break;
			}
		}
		if(okFlag)puts(input);
	}
	return 0;
}