#include<stdio.h>
int main()
{
	char p[11];
	int i,j,k,n[9][5]={{66,68},{65,67,69},{66,70},{65,69,71},{66,68,70,72},{67,69,73},{68,72},{69,71,73},{70,73}};
	for(;gets(p);)
	{
		
		for(j=0;p[j+1];j++)
		{
			for(k=0;n[p[j]-65][k];k++)
				if(p[j+1]==n[p[j]-65][k])
					break;
			if(!n[p[j]-65][k])
				break;
		}
		if(!p[j+1])
			puts(p);
	}
	return 0;
}